Skip to content

Commit

Permalink
[bigquery-pandas] pipe gcp location through to type handler (#12587)
Browse files Browse the repository at this point in the history
  • Loading branch information
jamiedemaria committed Mar 1, 2023
1 parent 83c875d commit ff7d080
Showing 1 changed file with 4 additions and 1 deletion.
Expand Up @@ -42,6 +42,7 @@ def handle_output(self, context: OutputContext, table_slice: TableSlice, obj: pd
with_uppercase_cols,
destination_table=f"{table_slice.schema}.{table_slice.table}",
project_id=table_slice.database,
location=context.resource_config["location"] if context.resource_config else None,
if_exists="append",
)

Expand All @@ -62,7 +63,9 @@ def handle_output(self, context: OutputContext, table_slice: TableSlice, obj: pd
def load_input(self, context: InputContext, table_slice: TableSlice, _) -> pd.DataFrame:
"""Loads the input as a Pandas DataFrame."""
result = pandas_gbq.read_gbq(
BigQueryClient.get_select_statement(table_slice), project_id=table_slice.database
BigQueryClient.get_select_statement(table_slice),
project_id=table_slice.database,
location=context.resource_config["location"] if context.resource_config else None,
)
result.columns = map(str.lower, result.columns)
return result
Expand Down

0 comments on commit ff7d080

Please sign in to comment.