I have a sqlite database with already existing tables
db = SqliteDatabase("C:/database.db")
class BaseModel(Model):
class Meta:
database = db
class SymbolModel(BaseModel):
symbol = CharField()
class EquityModel(BaseModel):
symbol = ForeignKeyField(SymbolModel, backref='equity')
This works fine.
Now I'd like to add a table, so I've modified my models.py like this:
class EarningsReleaseModel(BaseModel):
symbol = ForeignKeyField(SymbolModel, backref='earningsrelease')
and called, from a shell:
db.create_tables(EarningsReleaseModel)
However, I get this error:
sqlite3.OperationalError: no such table: earningsreleasemodel
Why?
EarningsReleaseModel.create_table()
是正确的语法。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.