mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-07 16:48:02 +00:00
Snowflake connection fix (#3986)
* snowflake-connection-fixed * code-formatted * ran-make-core_bump_version_dev
This commit is contained in:
parent
ee92311814
commit
7b64e536fe
@ -34,7 +34,6 @@ from metadata.generated.schema.metadataIngestion.workflow import (
|
|||||||
)
|
)
|
||||||
from metadata.ingestion.api.source import InvalidSourceException
|
from metadata.ingestion.api.source import InvalidSourceException
|
||||||
from metadata.ingestion.source.sql_source import SQLSource
|
from metadata.ingestion.source.sql_source import SQLSource
|
||||||
from metadata.ingestion.source.sql_source_common import SQLConnectionConfig
|
|
||||||
from metadata.utils.column_type_parser import create_sqlalchemy_type
|
from metadata.utils.column_type_parser import create_sqlalchemy_type
|
||||||
from metadata.utils.engines import get_engine
|
from metadata.utils.engines import get_engine
|
||||||
|
|
||||||
@ -45,23 +44,6 @@ ischema_names["GEOGRAPHY"] = GEOGRAPHY
|
|||||||
logger: logging.Logger = logging.getLogger(__name__)
|
logger: logging.Logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class SnowflakeConfig(SnowflakeConnection, SQLConnectionConfig):
|
|
||||||
result_limit: int = 1000
|
|
||||||
duration: Optional[int]
|
|
||||||
|
|
||||||
def get_connection_url(self):
|
|
||||||
connect_string = super().get_connection_url()
|
|
||||||
options = {
|
|
||||||
"account": self.account,
|
|
||||||
"warehouse": self.warehouse,
|
|
||||||
"role": self.role,
|
|
||||||
}
|
|
||||||
params = "&".join(f"{key}={value}" for (key, value) in options.items() if value)
|
|
||||||
if params:
|
|
||||||
connect_string = f"{connect_string}{params}"
|
|
||||||
return connect_string
|
|
||||||
|
|
||||||
|
|
||||||
class SnowflakeSource(SQLSource):
|
class SnowflakeSource(SQLSource):
|
||||||
def __init__(self, config, metadata_config):
|
def __init__(self, config, metadata_config):
|
||||||
connection_arguments = (
|
connection_arguments = (
|
||||||
|
@ -188,7 +188,7 @@ def _(connection: TrinoConnection):
|
|||||||
return connection.connectionArguments
|
return connection.connectionArguments
|
||||||
|
|
||||||
|
|
||||||
@get_connection_args.register
|
@get_connection_url.register
|
||||||
def _(connection: SnowflakeConnection):
|
def _(connection: SnowflakeConnection):
|
||||||
|
|
||||||
url = f"{connection.scheme.value}://"
|
url = f"{connection.scheme.value}://"
|
||||||
@ -217,6 +217,7 @@ def _(connection: SnowflakeConnection):
|
|||||||
f"{key}={quote_plus(value)}" for (key, value) in options.items() if value
|
f"{key}={quote_plus(value)}" for (key, value) in options.items() if value
|
||||||
)
|
)
|
||||||
url = f"{url}?{params}"
|
url = f"{url}?{params}"
|
||||||
|
return url
|
||||||
|
|
||||||
|
|
||||||
@get_connection_url.register
|
@get_connection_url.register
|
||||||
|
Loading…
x
Reference in New Issue
Block a user