DEV Community

Discussion on: Getting Error in SqlAlchemy

Collapse
 
burdier profile image
Burdier • Edited

class Storm(db.Model):
tablename='storm'
table_args (
db.UniqueConstraint('name','year'),
)

You are actually calling a magic method called tableargs__ but at this point there is not a function called like that, so I think what you want to do is something like this:

class Storm(db.Model):
tablename='storm'
table_args = ( #new edit
db.UniqueConstraint('name','year'),
)

Collapse
 
varuntumbe profile image
Varun Hegde

Ohh man, am so embarrassed right now. Thanks i got the mistake