add csv recognition to tooling (#3881)
Co-authored-by: Anna Scholtz <anna@scholtzan.net>
This commit is contained in:
Родитель
3f4f5a7f94
Коммит
c08f21c2d5
|
@ -1839,8 +1839,13 @@ def _deploy_external_data(
|
|||
_attach_metadata(metadata_file_path, table)
|
||||
|
||||
if not table.created:
|
||||
if metadata.external_data.format == ExternalDataFormat.GOOGLE_SHEET:
|
||||
external_config = bigquery.ExternalConfig("GOOGLE_SHEETS")
|
||||
if metadata.external_data.format in (
|
||||
ExternalDataFormat.GOOGLE_SHEET,
|
||||
ExternalDataFormat.CSV,
|
||||
):
|
||||
external_config = bigquery.ExternalConfig(
|
||||
metadata.external_data.format.value.upper()
|
||||
)
|
||||
external_config.source_uris = metadata.external_data.source_uris
|
||||
external_config.ignore_unknown_values = True
|
||||
external_config.autodetect = False
|
||||
|
@ -1851,6 +1856,7 @@ def _deploy_external_data(
|
|||
table.external_data_configuration = external_config
|
||||
table = client.create_table(table)
|
||||
click.echo(f"Destination table {full_table_id} created.")
|
||||
|
||||
else:
|
||||
click.echo(
|
||||
f"External data format {metadata.external_data.format} unsupported."
|
||||
|
|
|
@ -118,6 +118,7 @@ class ExternalDataFormat(enum.Enum):
|
|||
"""Represents the external types fo data that are supported to be integrated."""
|
||||
|
||||
GOOGLE_SHEET = "google_sheet"
|
||||
CSV = "csv"
|
||||
|
||||
|
||||
@attr.s(auto_attribs=True)
|
||||
|
|
Загрузка…
Ссылка в новой задаче