在没有 Glue 数据目录的情况下使用 AWS Glue 数据连接

Using AWS Glue data connection without Glue Data Catalog

创建共享数据连接和存储 login/password 等非常方便,但我不想使用胶水目录或爬虫。是否可以仅使用数据连接来获取胶水火花作业的连接 info/credentials,然后使用火花方法,绕过胶水目录和动态框架等?

创建共享连接后,您可以执行以下操作:

glue = boto3.client('glue', region_name='us-east-1')
    
response = glue.get_connection(
    Name='name-of-embedded-connection',
    HidePassword=False 
)

response['Connection']['ConnectionProperties']['USERNAME']
response['Connection']['ConnectionProperties']['PASSWORD']

发现不需要使用 boto3 和硬编码区域名称的更好方法:


    glueContext.extract_jdbc_conf('my_database_connection_name')

returns 类似的东西:

{'enforceSSL': 'true', 'skipCustomJDBCCertValidation': 'false', 'url': 'jdbc:sqlserver://xxxxxx', 'customJDBCCertString': '', 'user': 'xxxx', 'customJDBCCert': '', 'password': 'xxxxxxxxxx', 'vendor': 'sqlserver'}