Search code examples
pythonmysqldatabaseormstorm-orm

how to create a Storm table with no primary key?


I'm trying to use Storm to create an ORM to an existing MySQL db. I'm trying to create a table Class for one of the tables but I'm getting this error:

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

This table has no primary key, or any combination of columns that produce a unique row. It functions more like a log.

How do I create a Storm table class with no primary key?

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

    __storm_table__ = 'aggframe'

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

Solution

  • You can create a compound key:

    https://storm.canonical.com/Manual#Defining_compound_keys