コード例 #1
0
 def get_sql_alchemy_url(
     self,
     database: Optional[str] = None,
     username: Optional[str] = None,
     password: Optional[pydantic.SecretStr] = None,
     role: Optional[str] = None,
 ) -> str:
     if username is None:
         username = self.username
     if password is None:
         password = self.password
     if role is None:
         role = self.role
     return make_sqlalchemy_uri(
         self.scheme,
         username,
         password.get_secret_value() if password else None,
         self.account_id,
         f'"{database}"' if database is not None else database,
         uri_opts={
             # Drop the options if value is None.
             key: value
             for (key, value) in {
                 "authenticator": VALID_AUTH_TYPES.get(self.authentication_type),
                 "warehouse": self.warehouse,
                 "role": role,
                 "application": APPLICATION_NAME,
             }.items()
             if value
         },
     )
コード例 #2
0
 def get_sql_alchemy_url(self):
     return make_sqlalchemy_uri(
         self.scheme,
         self.username or "",
         self.password,
         f"athena.{self.aws_region}.amazonaws.com:443",
         self.database,
         uri_opts={
             "s3_staging_dir": self.s3_staging_dir,
             "work_group": self.work_group,
         },
     )
コード例 #3
0
 def get_sql_alchemy_url(self, database=None):
     return make_sqlalchemy_uri(
         self.scheme,
         self.username,
         self.password,
         self.host_port,
         database,
         uri_opts={
             # Drop the options if value is None.
             key: value
             for (key, value) in {
                 "warehouse": self.warehouse,
                 "role": self.role,
             }.items() if value
         },
     )
コード例 #4
0
ファイル: snowflake.py プロジェクト: taufiqibrahim/datahub
 def get_sql_alchemy_url(self, database=None):
     return make_sqlalchemy_uri(
         self.scheme,
         self.username,
         self.password.get_secret_value() if self.password else None,
         self.host_port,
         f'"{database}"' if database is not None else database,
         uri_opts={
             # Drop the options if value is None.
             key: value
             for (key, value) in {
                 "warehouse": self.warehouse,
                 "role": self.role,
                 "application": APPLICATION_NAME,
             }.items() if value
         },
     )