如何通过boto3在红移集群中创建表
我们有一个用例,在我们的AWS帐户中有多个群集,其中一个我们想使用模式创建一个表,
(
marketplaceId integer ,
cohort varchar(90) ,
segment varchar(90) ,
eventName varchar(90) ,
propensity_bin_id integer ,
run_date varchar(90) ,
model_version integer ,
customer_id numeric(38,0) ,
event_date date ,
role varchar(90) ,
dsi_split varchar(90) ,
target_metric varchar(90) ,
horizon varchar(90) ,
actual_target_value numeric(38,5) ,
predicted_baseline_value numeric(38,5) ,
predicted_treatment_value numeric(38,5) ,
winsorized_residual_value numeric(38,5) ,
residual_variance numeric(38,5) ,
is_valid integer ,
run_id varchar(90) ,
occurrence varchar(90)
);
我们可以通过Boto Client创建此表,我找不到相同的任何文档。对此的任何帮助将非常有帮助
We have a use case, where we have multiple cluster in our AWS account, in one of them we want to create a table with a schema
(
marketplaceId integer ,
cohort varchar(90) ,
segment varchar(90) ,
eventName varchar(90) ,
propensity_bin_id integer ,
run_date varchar(90) ,
model_version integer ,
customer_id numeric(38,0) ,
event_date date ,
role varchar(90) ,
dsi_split varchar(90) ,
target_metric varchar(90) ,
horizon varchar(90) ,
actual_target_value numeric(38,5) ,
predicted_baseline_value numeric(38,5) ,
predicted_treatment_value numeric(38,5) ,
winsorized_residual_value numeric(38,5) ,
residual_variance numeric(38,5) ,
is_valid integer ,
run_id varchar(90) ,
occurrence varchar(90)
);
Can we create this table via boto client, I am unable to find any documentation for the same. Any help on this would be super helpful
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要执行此操作,您需要发布SQL命令创建表,并且由于您想通过BOTO(而不是与数据库的JDBC或ODBC连接)进行此操作,因此您需要设置Redshift Data API。请参阅:
https:///docs.aws.aws.amazon.com/ redshift/最终/mgmt/data-api.html
和有关使用它的boto3信息:
https://boto3.amazonaws.com/v1/documentation/api/latest/latest/reference/reference/services/redshift-data.hta.hta.html
https:// https:///docs.aws.aws.aws.aws.amazon.com/redshift/latest/latest/latest/latest/ dg/r_create_table_new.html
请注意,要使用Redshift Data API,您将需要配置群集以启用它并在IAM中设置正确的角色和权限。
To perform this you will need to issue the SQL command CREATE TABLE and since you want to do this through boto (not a JDBC or ODBC connection to the database) you will need to set up Redshift Data API. See:
https://docs.aws.amazon.com/redshift/latest/mgmt/data-api.html
and the boto3 information about using it at:
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/redshift-data.html
Redshift CREATE TABLE reference:
https://docs.aws.amazon.com/redshift/latest/dg/r_CREATE_TABLE_NEW.html
Be aware that to use Redshift Data API you will need to configure you cluster to enable it and set up the correct roles and permissions in IAM.