File tree Expand file tree Collapse file tree 3 files changed +17
-0
lines changed
Expand file tree Collapse file tree 3 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -207,3 +207,4 @@ cython_debug/
207207# End of https://www.toptal.com/developers/gitignore/api/visualstudiocode,linux,python
208208
209209# Custom rules (everything added below won't be overriden by 'Generate .gitignore File' if you use 'Update' option)
210+ test.db
Original file line number Diff line number Diff line change 44- [ Installation] ( #installation )
55- [ Usage] ( #usage )
66 - [ Local Postgres server using Docker] ( #local-postgres-server-using-docker )
7+ - [ Use SQLite instead of PostgreSQL] ( #use-sqlite-instead-of-postgresql )
78- [ License] ( #license )
89
910## Introduction
@@ -84,6 +85,17 @@ docker exec -it postgres psql -U postgres
8485
8586This will allow you to edit or delete the database or records.
8687
88+ ### Use SQLite instead of PostgreSQL
89+
90+ For testing purposes, you can also use SQLite instead of PostgreSQL. To do so,
91+ open the [ dp.py] ( db.py ) file and comment out the PostgreSQL database in the
92+ ` DATABASE_URL ` environment variable and uncomment the SQLite database.
93+
94+ ``` python
95+ # DATABASE_URL = "postgresql+asyncpg://postgres:postgres@localhost/postgres"
96+ DATABASE_URL = " sqlite+aiosqlite:///./test.db"
97+ ```
98+
8799## License
88100
89101This project is licensed under the terms of the MIT license.
Original file line number Diff line number Diff line change 33from sqlalchemy .orm import declarative_base
44
55DATABASE_URL = "postgresql+asyncpg://postgres:postgres@localhost/postgres"
6+ # DATABASE_URL = "sqlite+aiosqlite:///./test.db"
7+ # Note that (as far as I can tell from the docs and searching) there is no need
8+ # to add 'check_same_thread=False' to the sqlite connection string, as
9+ # SQLAlchemy version 1.4+ will automatically add it for you when using SQLite.
610
711engine = create_async_engine (DATABASE_URL , echo = False )
812Base = declarative_base ()
You can’t perform that action at this time.
0 commit comments