mirror of
https://github.com/datahub-project/datahub.git
synced 2025-08-30 03:56:04 +00:00
chore(ingest): fix mssql lint (#6453)
This commit is contained in:
parent
33fd876421
commit
1ffd24131e
@ -136,13 +136,16 @@ class SQLServerSource(SQLAlchemySource):
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def _add_output_converters(conn: Connection) -> None:
|
def _add_output_converters(conn: Connection) -> None:
|
||||||
def handle_sql_variant_as_string(value):
|
def handle_sql_variant_as_string(value):
|
||||||
return value.decode('utf-16le')
|
return value.decode("utf-16le")
|
||||||
|
|
||||||
# see https://stackoverflow.com/questions/45677374/pandas-pyodbc-odbc-sql-type-150-is-not-yet-supported
|
# see https://stackoverflow.com/questions/45677374/pandas-pyodbc-odbc-sql-type-150-is-not-yet-supported
|
||||||
# and https://stackoverflow.com/questions/11671170/adding-output-converter-to-pyodbc-connection-in-sqlalchemy
|
# and https://stackoverflow.com/questions/11671170/adding-output-converter-to-pyodbc-connection-in-sqlalchemy
|
||||||
try:
|
try:
|
||||||
conn.connection.add_output_converter(-150, handle_sql_variant_as_string)
|
conn.connection.add_output_converter(-150, handle_sql_variant_as_string)
|
||||||
except AttributeError as e:
|
except AttributeError as e:
|
||||||
logger.debug(f"Failed to mount output converter for MSSQL data type -150 due to {e}")
|
logger.debug(
|
||||||
|
f"Failed to mount output converter for MSSQL data type -150 due to {e}"
|
||||||
|
)
|
||||||
|
|
||||||
def _populate_table_descriptions(self, conn: Connection, db_name: str) -> None:
|
def _populate_table_descriptions(self, conn: Connection, db_name: str) -> None:
|
||||||
# see https://stackoverflow.com/questions/5953330/how-do-i-map-the-id-in-sys-extended-properties-to-an-object-name
|
# see https://stackoverflow.com/questions/5953330/how-do-i-map-the-id-in-sys-extended-properties-to-an-object-name
|
||||||
|
Loading…
x
Reference in New Issue
Block a user