Is it the complete code ? If so then you have to create the table each time you connect to the DB. You use an in-memory DB (":memory:") so all the data of the DB is lost when you close the connection, including the schema of the DB.