Trouble with ".select()" Method in Peewee
<p>I am making a peewee database. In my python code I try to retrieve rows from the model that may be empty:</p>

<p><code>player_in_db = Player.select().where(Player.name == player.name_display_first_last)</code></p>

<p><code>Player</code> is the name of the model</p>

<p><code>name</code> is a field instance in <code>Player</code> defined...</p>

<pre><code>class Player(Model):
      name = CharField()
</code></pre>

<p><code>player.name_display_first_last</code> is a string</p>

<p>I get an error that says <code>peewee.OperationalError: no such column: t1.name</code></p>

<p>I've been trying to solve this problem for the bulk of today, but to no avail.  Any help would be much appreciated.  Let me know if you need any more information to help me.  Thanks.</p>

<p>The error says you're missing the <code>name</code> column in the table (named <code>t1</code>) that your Player model uses. Most likely you've told PeeWee to create the table for player before it had the name field or you simply haven't created the table at all. You should always try to fully write your model before creating it's table.</p>

<p>If you're just using test data for now, you can use <a href="http://docs.peewee-orm.com/en/latest/peewee/api.html#Database.drop_table" rel="nofollow"><code>drop_table()</code></a> to delete the entire table and then re-create it with <a href="http://docs.peewee-orm.com/en/latest/peewee/api.html#Database.create_tables" rel="nofollow"><code>create_tables()</code></a>.</p>

<pre><code>drop_tables(Player)
create_tables([Player])
</code></pre>

python database sqlite3 peewee datatable.select