mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-09-08 08:31:37 +00:00
Sql_alchemy_helper Engine fix (#3116)
* Added connect_args and options for creation of engine * Added connect_args to profiler engine * Error fixed on database_common profiler - isinstance error type or tuple of types
This commit is contained in:
parent
3d1c56511f
commit
84fd717c57
@ -41,7 +41,11 @@ class SQLAlchemyHelper:
|
|||||||
"""
|
"""
|
||||||
Create a SQLAlchemy connection to Database
|
Create a SQLAlchemy connection to Database
|
||||||
"""
|
"""
|
||||||
engine = create_engine(self.config.get_connection_url())
|
engine = create_engine(
|
||||||
|
self.config.get_connection_url(),
|
||||||
|
**self.config.options,
|
||||||
|
connect_args=self.config.connect_args
|
||||||
|
)
|
||||||
conn = engine.connect()
|
conn = engine.connect()
|
||||||
return conn
|
return conn
|
||||||
|
|
||||||
|
@ -218,7 +218,11 @@ class DatabaseCommon(Database):
|
|||||||
def __init__(self, config: SQLConnectionConfig):
|
def __init__(self, config: SQLConnectionConfig):
|
||||||
self.config = config
|
self.config = config
|
||||||
self.connection_string = self.config.get_connection_url()
|
self.connection_string = self.config.get_connection_url()
|
||||||
self.engine = create_engine(self.connection_string, **self.config.options)
|
self.engine = create_engine(
|
||||||
|
self.connection_string,
|
||||||
|
**self.config.options,
|
||||||
|
connect_args=self.config.connect_args,
|
||||||
|
)
|
||||||
self.connection = self.engine.raw_connection()
|
self.connection = self.engine.raw_connection()
|
||||||
self.inspector = inspect(self.engine)
|
self.inspector = inspect(self.engine)
|
||||||
|
|
||||||
@ -236,19 +240,19 @@ class DatabaseCommon(Database):
|
|||||||
|
|
||||||
def is_text(self, column_type: Type[types.TypeEngine]):
|
def is_text(self, column_type: Type[types.TypeEngine]):
|
||||||
for sql_type in _text_types:
|
for sql_type in _text_types:
|
||||||
if isinstance(column_type, sql_type):
|
if isinstance(column_type, type(sql_type)):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def is_number(self, column_type: Type[types.TypeEngine]):
|
def is_number(self, column_type: Type[types.TypeEngine]):
|
||||||
for sql_type in _numeric_types:
|
for sql_type in _numeric_types:
|
||||||
if isinstance(column_type, sql_type):
|
if isinstance(column_type, type(sql_type)):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def is_time(self, column_type: Type[types.TypeEngine]):
|
def is_time(self, column_type: Type[types.TypeEngine]):
|
||||||
for sql_type in _time_types:
|
for sql_type in _time_types:
|
||||||
if isinstance(column_type, sql_type):
|
if isinstance(column_type, type(sql_type)):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user