Skip to content

Commit 6bd90d4

Browse files
committed
Fix review comments
1 parent 0733295 commit 6bd90d4

4 files changed

Lines changed: 3 additions & 10 deletions

File tree

soda-core/src/soda_core/common/data_source_connection.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,6 @@ def _create_connection(self, connection_yaml_dict: dict) -> object:
3333
Exceptions do not need to be handled. They will be handled by the calling method.
3434
"""
3535

36-
def _post_connection_hook(self):
37-
"""
38-
Called after connection is created, e.g. in case you need to modify the connection object (see Oracle).
39-
"""
40-
4136
def open_connection(self) -> None:
4237
"""
4338
Ensures that an open connection is available.
@@ -50,7 +45,6 @@ def open_connection(self) -> None:
5045
try:
5146
logger.debug(f"'{self.name}' connection properties: {self.connection_properties}")
5247
self.connection = self._create_connection(self.connection_properties)
53-
self._post_connection_hook()
5448
except Exception as e:
5549
logger.error(msg=f"Could not connect to '{self.name}': {e}", exc_info=True)
5650

soda-core/src/soda_core/common/sql_ast.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ def __post_init__(self):
240240

241241
@dataclass
242242
class COLUMN(SqlExpression):
243-
name: SqlExpression | str # Modified to allow SQL expressions, e.g. if you need to use a case statement to generate a column during SELECT
243+
name: SqlExpression | str # Use SqlExpression if you need to generate and/or rename a column dymamically, e.g. using a CASE statement
244244
table_alias: Optional[str] = None
245245
field_alias: Optional[str] = None
246246

soda-core/src/soda_core/common/sql_dialect.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ def _build_column_sql(self, column: COLUMN) -> str:
346346
table_alias_sql: str = f"{self.quote_default(column.table_alias)}." if column.table_alias else ""
347347
column_sql: str = self.build_expression_sql(
348348
column.name
349-
) # Now supports any expression. If string is passed, will default to old quote_default behavior
349+
) # If column.name is a SqlExpression, it will be compiled; if a string, it will be quoted
350350
field_alias_sql: str = f" AS {self.quote_default(column.field_alias)}" if column.field_alias else ""
351351
return f"{table_alias_sql}{column_sql}{field_alias_sql}"
352352

soda-tests/tests/features/test_schema_check.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,7 @@ def test_schema_errors(data_source_test_helper: DataSourceTestHelper):
109109
assert varchar(512) == length_mismatch.get_expected()
110110

111111
type_mismatch = schema_check_result.column_data_type_mismatches[index_of_type_mismatch]
112-
expected_data_type = data_type_map[DBDataType.DATE]
113-
assert expected_data_type == type_mismatch.get_actual()
112+
assert data_type_map[DBDataType.DATE] == type_mismatch.get_actual()
114113
assert data_type_map[DBDataType.TEXT] == type_mismatch.get_expected()
115114

116115

0 commit comments

Comments
 (0)