How do I connect my python app to sqlite?
I enabled private networking, not really sure whats next. Tried giving the private network url as sqlite url, but thats erroring out.
SQLALCHEMY_DATABASE_URL = "sqlite3.railway.internal:////app/data/database.db"
15 Replies
Project ID:
7418d6aa-d7a2-45b1-962f-bfd0f0773a06
7418d6aa-d7a2-45b1-962f-bfd0f0773a06
sqlite is a file on disk, I'm not sure how the private network comes into play here.
you need to store the sqlite file in a volume, or use Postgres.
https://docs.railway.app/guides/volumes
I set it up from a template, with volume it wasnt working either
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) unable to open database file
dockerfile
created a volume at /app/data
please enclose that all in triple backticks
the time it was working, it wasnt persisting on redeploys π
So Im confused now
that means you are not using the correct paths to save the db file
volume mount path is - /app/data
what should be sqlite uri?
/app/data/database.db
thats not working
same error sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) unable to open database file
are you sure your code is setup to create a database file if one doesn't exist, since this is an empty volume, a database file indeed won't exist
I don't know if any of that is valid syntax, you would need to reference SQL alchemy's docs for that
it is valid, works locally.
anyways, i will try figure out on my own
its just not happening man what the hell
π
imma switch over to a normal vps at this point
ok it worked now π
what did you do?