【问题标题】:how to create a Storm table with no primary key?如何创建没有主键的 Storm 表?
【发布时间】:2010-09-13 19:05:53
【问题描述】:

我正在尝试使用 Storm 为现有的 MySQL 数据库创建 ORM。我正在尝试为其中一个表创建一个表类,但出现此错误:

storm.exceptions.ClassInfoError: <class 'statsstorm.Aggframe'> has no primary key information

此表没有主键,也没有生成唯一行的任何列组合。它的功能更像是一个日志。

如何创建没有主键的 Storm 表类?

class Aggframe(Storm):
    """ Storm-based interface to the stats.aggframe table."""

    __storm_table__ = 'aggframe'

    user = Unicode()
    dept = Unicode()
    frame_avg = Float()

【问题讨论】:

  • 为什么要创建没有主键的表?您为什么跳过 DBMS 理论课程中的这些课程?
  • 该表不是我创建的,我可能无法更改它。

标签: python mysql database orm storm-orm


【解决方案1】:

【讨论】:

    【解决方案2】:

    我不建议您创建没有 PK 的表。

    如果有的话,在该表中添加一个 IDENTITY 列并用作 PK。

    【讨论】:

    • 我同意,但不幸的是,该表是很久以前创建的,我可能无法更改它。
    猜你喜欢
    • 1970-01-01
    • 2011-04-29
    • 1970-01-01
    • 1970-01-01
    • 2011-07-23
    • 2020-11-13
    • 2018-09-12
    • 1970-01-01
    • 2021-12-04
    相关资源
    最近更新 更多