Skip to content

Commit 54caa6f

Browse files
bigquery: honor sourceFormat
1 parent f8f713a commit 54caa6f

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

packages/bigquery/src/table.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -867,9 +867,8 @@ Table.prototype.import = function(source, metadata, callback) {
867867
callback = callback || common.util.noop;
868868
metadata = metadata || {};
869869

870-
var format = metadata.sourceFormat || metadata.format;
871-
if (format) {
872-
metadata.sourceFormat = FORMATS[format.toLowerCase()];
870+
if (metadata.format) {
871+
metadata.sourceFormat = FORMATS[metadata.format.toLowerCase()];
873872
delete metadata.format;
874873
}
875874

packages/bigquery/test/table.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,11 +1095,13 @@ describe('BigQuery/Table', function() {
10951095
it('should not override a provided format with a File', function(done) {
10961096
table.bigQuery.request = function(reqOpts) {
10971097
var sourceFormat = reqOpts.json.configuration.load.sourceFormat;
1098-
assert.equal(sourceFormat, 'CSV');
1098+
assert.equal(sourceFormat, 'NEWLINE_DELIMITED_JSON');
10991099
done();
11001100
};
11011101

1102-
table.import(FILE, { sourceFormat: 'CSV' }, assert.ifError);
1102+
table.import(FILE, {
1103+
sourceFormat: 'NEWLINE_DELIMITED_JSON'
1104+
}, assert.ifError);
11031105
});
11041106

11051107
it('should execute the callback with error', function(done) {

0 commit comments

Comments
 (0)