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

added fix for transform_column_name and changed code to pass test #98

Merged
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
10 changes: 7 additions & 3 deletions target_bigquery/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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("`")
Expand Down
Loading