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/
207
207
# End of https://www.toptal.com/developers/gitignore/api/visualstudiocode,linux,python
208
208
209
209
# 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 4
4
- [ Installation] ( #installation )
5
5
- [ Usage] ( #usage )
6
6
- [ Local Postgres server using Docker] ( #local-postgres-server-using-docker )
7
+ - [ Use SQLite instead of PostgreSQL] ( #use-sqlite-instead-of-postgresql )
7
8
- [ License] ( #license )
8
9
9
10
## Introduction
@@ -84,6 +85,17 @@ docker exec -it postgres psql -U postgres
84
85
85
86
This will allow you to edit or delete the database or records.
86
87
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
+
87
99
## License
88
100
89
101
This project is licensed under the terms of the MIT license.
Original file line number Diff line number Diff line change 3
3
from sqlalchemy .orm import declarative_base
4
4
5
5
DATABASE_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.
6
10
7
11
engine = create_async_engine (DATABASE_URL , echo = False )
8
12
Base = declarative_base ()
You can’t perform that action at this time.
0 commit comments