Skip to content

Commit d84cedf

Browse files
committed
Fix load from gcs
1 parent c2cecdc commit d84cedf

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

lib/big_query/client/job_types.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def _extract(opts)
2727
def _load(opts)
2828
_opts = opts.dup
2929
_opts[:destination_table] = Google::Apis::BigqueryV2::TableReference.new(_opts[:destination_table])
30-
_opts[:schema] = Google::Apis::BigqueryV2::TableSchema.new({ fields: _opts[:schema][:fields] })
30+
_opts[:schema] = Google::Apis::BigqueryV2::TableSchema.new(_opts[:schema]) if _opts[:schema]
3131
Google::Apis::BigqueryV2::JobConfigurationLoad.new(
3232
_opts
3333
)

lib/big_query/client/load.rb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,17 @@ module Insert
99
def load(opts)
1010
_opts = deep_symbolize_keys(opts)
1111
job_configuration = Google::Apis::BigqueryV2::JobConfiguration.new(
12-
load: _load(_opts)
12+
load: _load(_opts[:load])
1313
)
1414
job_configuration.dry_run = _opts[:dry_run] if _opts[:dry_run]
1515
job = Google::Apis::BigqueryV2::Job.new(
1616
configuration: job_configuration
1717
)
18-
@client.insert_job(
19-
@project_id,
20-
job
18+
api(
19+
@client.insert_job(
20+
@project_id,
21+
job
22+
)
2123
)
2224
end
2325
end

0 commit comments

Comments
 (0)