1

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.

1 Answer 1

1

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...

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.