I am using sqlite3 with python, and after connecting to the database and creating a table, sqlite3 shows an error when I try to execute a SELECT statment on the table with the name of the databse in it :
con = sqlite3.connect("my_databse")
cur = con.cursor()
cur.execute('''CREATE TABLE my_table ... ''')
cur.execute("SELECT * FROM my_database.my_table") # this works fine without the name of the database before the table name
but I get this error from sqlite3 : no such table : my_database.my_table
Is there a way to do a SELECT statment with the name of the database in it ?
"my_databse". Also, since you've already connected to that database, why are you trying to use the database name in the select statement?sqlitefile contains only one database. There is no point in prefixing it to the table name. If you are doing this because you plan to migrate your code to a multi-user database at some point, it might be better to do your development on a database that is more like the intended target. Naming the tables will be the least of your problems migrating fromsqlite.