user297250
user297250

Reputation:

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()

Upvotes: 0

Views: 673

Answers (2)

dotz
dotz

Reputation: 964

You can create a compound key:

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

Upvotes: 1

Raj More
Raj More

Reputation: 48034

I don't recommend that you create a table without a PK.

If anything, add an IDENTITY column in that table and use as PK.

Upvotes: 1

Related Questions