Skip to content

Commit

Permalink
Process comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Fokko committed Dec 5, 2019
1 parent 2f17424 commit ca45436
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
3 changes: 1 addition & 2 deletions core/dbt/adapters/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from copy import deepcopy
from typing import Optional

from dbt.adapters.cache import _CachedRelation
from dbt.logger import CACHE_LOGGER as logger
import dbt.exceptions

Expand Down Expand Up @@ -86,7 +85,7 @@ def key(self):
"""
return _make_key(self)

def add_reference(self, referrer: _CachedRelation):
def add_reference(self, referrer: '_CachedRelation'):
"""Add a reference from referrer to self, indicating that if this node
were drop...cascaded, the referrer would be dropped as well.
Expand Down
20 changes: 10 additions & 10 deletions core/dbt/adapters/sql/impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def convert_time_type(cls, agate_table: agate.Table, col_idx: int) -> str:
def is_cancelable(cls) -> bool:
return True

def expand_column_types(self, goal, current, model_name: Optional[str] = None):
def expand_column_types(self, goal, current):
reference_columns = {
c.name: c for c in
self.get_columns_in_relation(goal)
Expand Down Expand Up @@ -133,7 +133,7 @@ def alter_column_type(self, relation, column_name, new_column_type) -> None:
kwargs=kwargs
)

def drop_relation(self, relation, model_name: Optional[str] = None):
def drop_relation(self, relation):
if relation.type is None:
dbt.exceptions.raise_compiler_error(
'Tried to drop relation {}, but its type is null.'
Expand All @@ -145,13 +145,13 @@ def drop_relation(self, relation, model_name: Optional[str] = None):
kwargs={'relation': relation}
)

def truncate_relation(self, relation, model_name: Optional[str] = None):
def truncate_relation(self, relation):
self.execute_macro(
TRUNCATE_RELATION_MACRO_NAME,
kwargs={'relation': relation}
)

def rename_relation(self, from_relation, to_relation, model_name: Optional[str] = None):
def rename_relation(self, from_relation, to_relation):
self.cache_renamed(from_relation, to_relation)

kwargs = {'from_relation': from_relation, 'to_relation': to_relation}
Expand All @@ -160,13 +160,13 @@ def rename_relation(self, from_relation, to_relation, model_name: Optional[str]
kwargs=kwargs
)

def get_columns_in_relation(self, relation: str, model_name: Optional[str] = None):
def get_columns_in_relation(self, relation: str):
return self.execute_macro(
GET_COLUMNS_IN_RELATION_MACRO_NAME,
kwargs={'relation': relation}
)

def create_schema(self, database: str, schema: str, model_name: Optional[str] = None) -> None:
def create_schema(self, database: str, schema: str) -> None:
logger.debug('Creating schema "{}"."{}".', database, schema)
kwargs = {
'database_name': self.quote_as_configured(database, 'database'),
Expand All @@ -175,7 +175,7 @@ def create_schema(self, database: str, schema: str, model_name: Optional[str] =
self.execute_macro(CREATE_SCHEMA_MACRO_NAME, kwargs=kwargs)
self.commit_if_has_connection()

def drop_schema(self, database: str, schema: str, model_name: Optional[str] = None) -> None:
def drop_schema(self, database: str, schema: str) -> None:
logger.debug('Dropping schema "{}"."{}".', database, schema)
kwargs = {
'database_name': self.quote_as_configured(database, 'database'),
Expand All @@ -184,7 +184,7 @@ def drop_schema(self, database: str, schema: str, model_name: Optional[str] = No
self.execute_macro(DROP_SCHEMA_MACRO_NAME,
kwargs=kwargs)

def list_relations_without_caching(self, information_schema, schema, model_name: Optional[str] = None) -> List[BaseRelation]:
def list_relations_without_caching(self, information_schema, schema) -> List[BaseRelation]:
kwargs = {'information_schema': information_schema, 'schema': schema}
results = self.execute_macro(
LIST_RELATIONS_MACRO_NAME,
Expand Down Expand Up @@ -214,15 +214,15 @@ def list_relations_without_caching(self, information_schema, schema, model_name:
def quote(self, identifier):
return '"{}"'.format(identifier)

def list_schemas(self, database: str, model_name: Optional[str] = None) -> List[str]:
def list_schemas(self, database: str) -> List[str]:
results = self.execute_macro(
LIST_SCHEMAS_MACRO_NAME,
kwargs={'database': database}
)

return [row[0] for row in results]

def check_schema_exists(self, database: str, schema: str, model_name: Optional[str] = None) -> bool:
def check_schema_exists(self, database: str, schema: str) -> bool:
information_schema = self.Relation.create(
database=database,
schema=schema,
Expand Down

0 comments on commit ca45436

Please sign in to comment.