Snowflake connection fix (#3986)

* snowflake-connection-fixed

* code-formatted

* ran-make-core_bump_version_dev
This commit is contained in:
codingwithabhi 2022-04-09 20:03:46 +05:30 committed by GitHub
parent ee92311814
commit 7b64e536fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 19 deletions

View File

@ -34,7 +34,6 @@ from metadata.generated.schema.metadataIngestion.workflow import (
)
from metadata.ingestion.api.source import InvalidSourceException
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.engines import get_engine
@ -45,23 +44,6 @@ ischema_names["GEOGRAPHY"] = GEOGRAPHY
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):
def __init__(self, config, metadata_config):
connection_arguments = (

View File

@ -188,7 +188,7 @@ def _(connection: TrinoConnection):
return connection.connectionArguments
@get_connection_args.register
@get_connection_url.register
def _(connection: SnowflakeConnection):
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
)
url = f"{url}?{params}"
return url
@get_connection_url.register