Skip to content

Commit

Permalink
Run black formatter on all files
Browse files Browse the repository at this point in the history
  • Loading branch information
mwallace582 committed Jan 16, 2024
1 parent 5ae143d commit f0507ba
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 39 deletions.
4 changes: 1 addition & 3 deletions dbt/adapters/mariadb/connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,5 @@ def get_response(cls, cursor) -> AdapterResponse:
# the mysql-connector-python driver.
# So just return the default value.
return AdapterResponse(
_message="{} {}".format(code, num_rows),
rows_affected=num_rows,
code=code
_message="{} {}".format(code, num_rows), rows_affected=num_rows, code=code
)
15 changes: 5 additions & 10 deletions dbt/adapters/mariadb/impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ def date_function(cls):
return "current_date()"

@classmethod
def convert_datetime_type(cls, agate_table: agate.Table,
col_idx: int) -> str:
def convert_datetime_type(cls, agate_table: agate.Table, col_idx: int) -> str:
return "timestamp"

def quote(self, identifier):
Expand All @@ -45,8 +44,7 @@ def list_relations_without_caching( # type: ignore[override]
) -> List[MariaDBRelation]:
kwargs = {"schema_relation": schema_relation}
try:
results = self.execute_macro(LIST_RELATIONS_MACRO_NAME,
kwargs=kwargs)
results = self.execute_macro(LIST_RELATIONS_MACRO_NAME, kwargs=kwargs)
except dbt.exceptions.DbtRuntimeError as e:
errmsg = getattr(e, "msg", "")
if f"MariaDB database '{schema_relation}' not found" in errmsg:
Expand Down Expand Up @@ -116,8 +114,7 @@ def get_catalog(self, manifest: Manifest) -> Tuple[agate.Table, List[Exception]]

if len(schema_map) > 1:
raise dbt.exceptions.CompilationError(
f"Expected only one database in get_catalog, found "
f"{list(schema_map)}"
f"Expected only one database in get_catalog, found " f"{list(schema_map)}"
)

with executor(self.config) as tpe:
Expand Down Expand Up @@ -145,8 +142,7 @@ def _get_one_catalog(
) -> agate.Table:
if len(schemas) != 1:
raise dbt.exceptions.CompilationError(
f"Expected only one schema in mariadb _get_one_catalog, found "
f"{schemas}"
f"Expected only one schema in mariadb _get_one_catalog, found " f"{schemas}"
)

database = information_schema.database
Expand All @@ -156,8 +152,7 @@ def _get_one_catalog(
for relation in self.list_relations(database, schema):
logger.debug("Getting table schema for relation {}", relation)
columns.extend(self._get_columns_for_catalog(relation)) # type: ignore[arg-type]
return agate.Table.from_object(columns,
column_types=DEFAULT_TYPE_TESTER)
return agate.Table.from_object(columns, column_types=DEFAULT_TYPE_TESTER)

def check_schema_exists(self, database, schema):
results = self.execute_macro(LIST_SCHEMAS_MACRO_NAME, kwargs={"database": database})
Expand Down
4 changes: 1 addition & 3 deletions dbt/adapters/mysql/connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,5 @@ def get_response(cls, cursor) -> AdapterResponse:
# mysql-connector-python driver.
# So just return the default value.
return AdapterResponse(
_message="{} {}".format(code, num_rows),
rows_affected=num_rows,
code=code
_message="{} {}".format(code, num_rows), rows_affected=num_rows, code=code
)
15 changes: 5 additions & 10 deletions dbt/adapters/mysql/impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ def date_function(cls):
return "current_date()"

@classmethod
def convert_datetime_type(cls, agate_table: agate.Table,
col_idx: int) -> str:
def convert_datetime_type(cls, agate_table: agate.Table, col_idx: int) -> str:
return "timestamp"

def quote(self, identifier):
Expand All @@ -45,8 +44,7 @@ def list_relations_without_caching( # type: ignore[override]
) -> List[MySQLRelation]:
kwargs = {"schema_relation": schema_relation}
try:
results = self.execute_macro(LIST_RELATIONS_MACRO_NAME,
kwargs=kwargs)
results = self.execute_macro(LIST_RELATIONS_MACRO_NAME, kwargs=kwargs)
except dbt.exceptions.DbtRuntimeError as e:
errmsg = getattr(e, "msg", "")
if f"MySQL database '{schema_relation}' not found" in errmsg:
Expand Down Expand Up @@ -116,8 +114,7 @@ def get_catalog(self, manifest: Manifest) -> Tuple[agate.Table, List[Exception]]

if len(schema_map) > 1:
raise dbt.exceptions.CompilationError(
f"Expected only one database in get_catalog, found "
f"{list(schema_map)}"
f"Expected only one database in get_catalog, found " f"{list(schema_map)}"
)

with executor(self.config) as tpe:
Expand Down Expand Up @@ -145,8 +142,7 @@ def _get_one_catalog(
) -> agate.Table:
if len(schemas) != 1:
raise dbt.exceptions.CompilationError(
f"Expected only one schema in mysql _get_one_catalog, found "
f"{schemas}"
f"Expected only one schema in mysql _get_one_catalog, found " f"{schemas}"
)

database = information_schema.database
Expand All @@ -156,8 +152,7 @@ def _get_one_catalog(
for relation in self.list_relations(database, schema):
logger.debug("Getting table schema for relation {}", relation)
columns.extend(self._get_columns_for_catalog(relation)) # type: ignore[arg-type]
return agate.Table.from_object(columns,
column_types=DEFAULT_TYPE_TESTER)
return agate.Table.from_object(columns, column_types=DEFAULT_TYPE_TESTER)

def check_schema_exists(self, database, schema):
results = self.execute_macro(LIST_SCHEMAS_MACRO_NAME, kwargs={"database": database})
Expand Down
4 changes: 1 addition & 3 deletions dbt/adapters/mysql5/connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,5 @@ def get_response(cls, cursor) -> AdapterResponse:
# the mysql-connector-python driver.
# So just return the default value.
return AdapterResponse(
_message="{} {}".format(code, num_rows),
rows_affected=num_rows,
code=code
_message="{} {}".format(code, num_rows), rows_affected=num_rows, code=code
)
15 changes: 5 additions & 10 deletions dbt/adapters/mysql5/impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ def date_function(cls):
return "current_date()"

@classmethod
def convert_datetime_type(cls, agate_table: agate.Table,
col_idx: int) -> str:
def convert_datetime_type(cls, agate_table: agate.Table, col_idx: int) -> str:
return "timestamp"

def quote(self, identifier):
Expand All @@ -45,8 +44,7 @@ def list_relations_without_caching( # type: ignore[override]
) -> List[MySQLRelation]:
kwargs = {"schema_relation": schema_relation}
try:
results = self.execute_macro(LIST_RELATIONS_MACRO_NAME,
kwargs=kwargs)
results = self.execute_macro(LIST_RELATIONS_MACRO_NAME, kwargs=kwargs)
except dbt.exceptions.DbtRuntimeError as e:
errmsg = getattr(e, "msg", "")
if f"MySQL database '{schema_relation}' not found" in errmsg:
Expand Down Expand Up @@ -116,8 +114,7 @@ def get_catalog(self, manifest: Manifest) -> Tuple[agate.Table, List[Exception]]

if len(schema_map) > 1:
raise dbt.exceptions.CompilationError(
f"Expected only one database in get_catalog, found "
f"{list(schema_map)}"
f"Expected only one database in get_catalog, found " f"{list(schema_map)}"
)

with executor(self.config) as tpe:
Expand Down Expand Up @@ -145,8 +142,7 @@ def _get_one_catalog(
) -> agate.Table:
if len(schemas) != 1:
raise dbt.exceptions.CompilationError(
f"Expected only one schema in mysql5 _get_one_catalog, found "
f"{schemas}"
f"Expected only one schema in mysql5 _get_one_catalog, found " f"{schemas}"
)

database = information_schema.database
Expand All @@ -156,8 +152,7 @@ def _get_one_catalog(
for relation in self.list_relations(database, schema):
logger.debug("Getting table schema for relation {}", relation)
columns.extend(self._get_columns_for_catalog(relation)) # type: ignore[arg-type]
return agate.Table.from_object(columns,
column_types=DEFAULT_TYPE_TESTER)
return agate.Table.from_object(columns, column_types=DEFAULT_TYPE_TESTER)

def check_schema_exists(self, database, schema):
results = self.execute_macro(LIST_SCHEMAS_MACRO_NAME, kwargs={"database": database})
Expand Down

0 comments on commit f0507ba

Please sign in to comment.