Skip to content

Commit 96e97b6

Browse files
authored
add billing_project parameter for BQ (#182)
Co-authored-by: juanrmn <jgonzalez@cartodb.com>
1 parent 5087dee commit 96e97b6

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

raster_loader/cli/bigquery.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ def bigquery(args=None):
4242
@click.option("--token", help="An access token to authenticate with.", default=None)
4343
@click.option("--dataset", help="The name of the dataset.", required=True)
4444
@click.option("--table", help="The name of the table.", default=None)
45+
@click.option(
46+
"--billing_project",
47+
help="The name of the billing project. "
48+
"Default value is the --project parameter.",
49+
default=None,
50+
)
4551
@click.option(
4652
"--band",
4753
help="Band(s) within raster to upload. "
@@ -122,6 +128,7 @@ def upload(
122128
token,
123129
dataset,
124130
table,
131+
billing_project,
125132
band,
126133
band_name,
127134
chunk_size,
@@ -169,7 +176,9 @@ def upload(
169176
if token is not None:
170177
credentials = AccessTokenCredentials(token)
171178

172-
connection = BigQueryConnection(project, credentials)
179+
# Use billing_project for BigQuery connection (billing), default to project if not provided
180+
effective_billing_project = billing_project if billing_project is not None else project
181+
connection = BigQueryConnection(effective_billing_project, credentials)
173182

174183
source = file_path if is_local_file else file_url
175184

@@ -188,6 +197,7 @@ def upload(
188197
click.echo("Number of Blocks: {}".format(num_blocks))
189198
click.echo("Block Dims: {}".format(get_block_dims(source)))
190199
click.echo("Project: {}".format(project))
200+
click.echo("Billing Project: {}".format(effective_billing_project))
191201
click.echo("Dataset: {}".format(dataset))
192202
click.echo("Table: {}".format(table))
193203
click.echo("Number of Records Per BigQuery Append: {}".format(chunk_size))

0 commit comments

Comments
 (0)