Skip to content

Commit

Permalink
fix: use write_truncate for archive2bq factory (#3051)
Browse files Browse the repository at this point in the history
* fix: use `write_truncate` for `archive2bq` factory

* fix: use `WriteDisposition` from google.cloud
  • Loading branch information
Jabolol authored Feb 16, 2025
1 parent 92ed61a commit 2121615
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion warehouse/oso_dagster/factories/archive2bq.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@
from dagster import AssetExecutionContext, MaterializeResult, asset
from dagster_gcp import BigQueryResource, GCSResource
from google.api_core.exceptions import NotFound
from google.cloud.bigquery import LoadJobConfig, SchemaField, SourceFormat
from google.cloud.bigquery import (
LoadJobConfig,
SchemaField,
SourceFormat,
WriteDisposition,
)
from oso_dagster.factories.common import AssetDeps, AssetFactoryResponse, GenericAsset
from oso_dagster.utils.gcs import batch_delete_folder

Expand Down Expand Up @@ -274,6 +279,7 @@ def upload_file_to_bq(
),
source_format=asset_config.source_format,
allow_quoted_newlines=True,
write_disposition=WriteDisposition.WRITE_TRUNCATE,
)

load_job = bq_client.load_table_from_uri(
Expand Down

0 comments on commit 2121615

Please sign in to comment.