如何解决如何在`redshift_connector`中设置架构?
我正在使用 redshift_connector - Amazon Redshift connector for Python >= 3.5
如何在从 python 运行代码时设置模式。
import redshift_connector
# Connects to Redshift cluster using AWS credentials
conn = redshift_connector.connect(
host='examplecluster.abc123xyz789.us-west-1.redshift.amazonaws.com',database='dev',user='awsuser',password='my_password'
)
cursor = conn.cursor()
cursor.execute("create awesome_schema.Temp table book(bookname varchar,author varchar)")
cursor.execute("select * from awesome_schema.book")
这就是我在代码中将架构设置为 awesome_schema
的方式。
但这非常乏味且不可配置。当然,我可以操作字符串并设置模式。
但我想知道有没有更好的方法来设置 Schema
?
我已经查看了 https://github.com/aws/amazon-redshift-python-driver 存储库,但没有找到很多合适的示例。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。