开发者社区 问答 正文

PyODPS中使用create_table()方法创建表的方式是什么?

PyODPS中使用create_table()方法创建表的方式是什么?

展开
收起
游客nxq6attzvywgk 2021-12-11 13:55:44 1391 分享
分享
版权
举报
1 条回答
写回答
取消 提交回答
  • 使用create_table()方法创建表的方式是:

    1、使用表Schema创建表

    table = o.create_table('my_new_table', schema) table = o.create_table('my_new_table', schema, if_not_exists=True) # 只有不存在表时,才创建表。

    table = o.create_table('my_new_table', schema, lifecycle=7) # 设置生命周期。

    2、采用字段名及字段类型字符串创建表

    创建非分区表。 table = o.create_table('my_new_table', 'num bigint, num2 double', if_not_exists=True)

    创建分区表可传入(表字段列表,分区字段列表)。 table = o.create_table('my_new_table', ('num bigint, num2 double', 'pt string'), if_not_exists=True)

    2021-12-11 13:56:54 举报
    赞同 评论

    评论

    全部评论 (0)

    登录后可评论
问答地址:
AI助理

你好,我是AI助理

可以解答问题、推荐解决方案等