Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add append option to skip check #114

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions raster_loader/cli/bigquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ def bigquery(args=None):
default=False,
is_flag=True,
)
@click.option(
"--append",
help="Append records into a table if it already exists.",
default=False,
is_flag=True,
)
@click.option(
"--output_quadbin",
help=(
Expand All @@ -56,6 +62,7 @@ def upload(
chunk_size,
input_crs,
overwrite=False,
append=False,
output_quadbin=False,
test=False,
):
Expand Down Expand Up @@ -110,6 +117,7 @@ def upload(
input_crs,
client=client,
overwrite=overwrite,
append=append,
output_quadbin=output_quadbin,
)

Expand Down
3 changes: 2 additions & 1 deletion raster_loader/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -971,6 +971,7 @@ def rasterio_to_bigquery(
input_crs: int = None,
client=None,
overwrite: bool = False,
append: bool = False,
output_quadbin: bool = False,
pseudo_planar: bool = False,
) -> bool:
Expand Down Expand Up @@ -1041,7 +1042,7 @@ def rasterio_to_bigquery(
elif not check_if_bigquery_table_is_empty(
project_id, dataset_id, table_id, client
):
append_records = ask_yes_no_question(
append_records = append or ask_yes_no_question(
f"Table {table_id} already exists in dataset {dataset_id} "
"and is not empty. Append records? [yes/no] "
)
Expand Down