Skip to content

Commit

Permalink
Rework constructor for mypy. Remove unused functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
peterallenwebb committed Sep 22, 2023
1 parent 27ade3d commit 3f4b8e0
Showing 1 changed file with 4 additions and 34 deletions.
38 changes: 4 additions & 34 deletions dbt/adapters/bigquery/impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,10 @@ class BigQueryAdapter(BaseAdapter):
ConstraintType.foreign_key: ConstraintSupport.ENFORCED,
}

def __init__(self, config) -> None:
super().__init__(config)
self.connections: BigQueryConnectionManager = self.connections

###
# Implementations of abstract methods
###
Expand Down Expand Up @@ -481,40 +485,6 @@ def _agate_to_schema(
bq_schema.append(SchemaField(col_name, type_)) # type: ignore[arg-type]
return bq_schema

def _materialize_as_view(self, model: Dict[str, Any]) -> str:
model_database = model.get("database")
model_schema = model.get("schema")
model_alias = model.get("alias")
model_code = model.get("compiled_code")

logger.debug("Model SQL ({}):\n{}".format(model_alias, model_code))
self.connections.create_view(
database=model_database, schema=model_schema, table_name=model_alias, sql=model_code
)
return "CREATE VIEW"

def _materialize_as_table(
self,
model: Dict[str, Any],
model_sql: str,
decorator: Optional[str] = None,
) -> str:
model_database = model.get("database")
model_schema = model.get("schema")
model_alias = model.get("alias")

if decorator is None:
table_name = model_alias
else:
table_name = "{}${}".format(model_alias, decorator)

logger.debug("Model SQL ({}):\n{}".format(table_name, model_sql))
self.connections.create_table(
database=model_database, schema=model_schema, table_name=table_name, sql=model_sql
)

return "CREATE TABLE"

@available.parse(lambda *a, **k: "")
def copy_table(self, source, destination, materialization):
if materialization == "incremental":
Expand Down

0 comments on commit 3f4b8e0

Please sign in to comment.