Discussion:
[sqlalchemy] no such table error
s***@gmail.com
2014-12-11 00:23:53 UTC
Permalink
I had an issue while running my flask application:
https://github.com/mitsuhiko/flask/issues/1274

The suggested workaround is to add /home/sam to sys.path, however, if I
remove the "pantry." part from the import statements and execute from
within the pantry/ directory with `python3.4 run.py` it runs. Having to add
a package to sys.path before running it or even having to remove part of
the import statement as mentioned doesn't seem right, but that's not the
problem.

The problem now is that my application can't find the table:
"sqlalchemy.exc.OperationalError: (OperationalError) no such table: food
'SELECT food.id AS food_id, food.name AS food_name, food.amount AS
food_amount \nFROM food' ()"

I've created the db before though:
https://gist.github.com/uunsamp/7650f5a3882fc76ad314

I don't understand why that wouldn't be sufficient. I'm all eyes and ears
if anyone has the patience to respond!
--
You received this message because you are subscribed to the Google Groups "sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.
Simon King
2014-12-11 11:12:14 UTC
Permalink
Post by s***@gmail.com
https://github.com/mitsuhiko/flask/issues/1274
The suggested workaround is to add /home/sam to sys.path, however, if I
remove the "pantry." part from the import statements and execute from within
the pantry/ directory with `python3.4 run.py` it runs. Having to add a
package to sys.path before running it or even having to remove part of the
import statement as mentioned doesn't seem right, but that's not the
problem.
"sqlalchemy.exc.OperationalError: (OperationalError) no such table: food
'SELECT food.id AS food_id, food.name AS food_name, food.amount AS
food_amount \nFROM food' ()"
https://gist.github.com/uunsamp/7650f5a3882fc76ad314
I don't understand why that wouldn't be sufficient. I'm all eyes and ears if
anyone has the patience to respond!
Are you sure that the database you created in the first step is the
same one you are using at runtime? Using Flask-SQLAlchemy obscures
some of the details here - I would probably put a print statement
inside sqlalchemy.create_engine to see exactly what file is being
used, and I would use the sqlite3 command line tool to inspect the
contents of that file.

Hope that helps,

Simon
--
You received this message because you are subscribed to the Google Groups "sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.
Continue reading on narkive:
Loading...