From 9d1d0b08606a716a5a36f53b3388cbd6055535a8 Mon Sep 17 00:00:00 2001 From: Love Eklund <144315692+loveeklund-osttra@users.noreply.github.com> Date: Mon, 30 Sep 2024 19:49:55 +0200 Subject: [PATCH] added fix for transform_column_name and changed code to pass test (#98) --- target_bigquery/core.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/target_bigquery/core.py b/target_bigquery/core.py index 018297b..3cf69cc 100644 --- a/target_bigquery/core.py +++ b/target_bigquery/core.py @@ -751,8 +751,8 @@ def generate_view_statement(self, table_name: BigQueryTable) -> str: ) return ( - f"CREATE OR REPLACE VIEW {table_name.get_escaped_name('_view')} AS \nSELECT" - f" \n{projection} FROM {table_name.get_escaped_name()}" + f"CREATE OR REPLACE VIEW {table_name.get_escaped_name('_view')} AS\nSELECT" + f"\n{projection} FROM {table_name.get_escaped_name()}" ) def _jsonschema_property_to_bigquery_column( @@ -1084,8 +1084,12 @@ def transform_column_name( add_underscore_when_invalid: bool = False, snake_case: bool = False, replace_period_with_underscore: bool = False, + **kwargs ) -> str: - """Transform a column name to a valid BigQuery column name.""" + """Transform a column name to a valid BigQuery column name. + kwargs is here to handle unspecified column tranforms, this can become an issue if config is added in main + branch but code is versioned to run on an old commit. + """ if snake_case and not lower: lower = True was_quoted = name.startswith("`") and name.endswith("`")