Reputation: 85
I am making a peewee database. In my python code I try to retrieve rows from the model that may be empty:
player_in_db = Player.get(Player.name == player.name_display_first_last)
Player
is the name of the model
name
is a column in Player
defined:
name = CharField(max_length=25)
player.name_display_first_last
is a string
I then check to see if there are any rows in the player_in_db
list:
if player_in_db:
I then get an error that says:
sqlite3.OperationalError: no such column: t1.name
I can give you more of the error message if you need, but it's long and references a lot of peewee packages.
Upvotes: 1
Views: 2160
Reputation: 26225
You probably created your table without the name
column. It's incredibly easy to check. Just open the sqlite3 shell and run:
sqlite3> .schema
Or you can use Peewee's own introspection methods:
db.get_columns('player')
Your model needs to (obviously) correspond to the schema in your actual database...
Upvotes: 1