Spaces:
Runtime error
Runtime error
Download database/connection.py from qqqsfasdf/Games-In-Arabic: direct link, hf CLI and curl.
- Browser
- Download file 542 Bytes
-
https://huggingface.co/spaces/qqqsfasdf/Games-In-Arabic/resolve/main/database/connection.py
- Command line
-
hf download hf://spaces/qqqsfasdf/Games-In-Arabic/database/connection.py
-
curl -L -o connection.py https://huggingface.co/spaces/qqqsfasdf/Games-In-Arabic/resolve/main/database/connection.py
542 Bytes
| # database/connection.py | |
| import os | |
| import sqlite3 | |
| DB_PATH = os.path.join( | |
| os.path.dirname(os.path.dirname(os.path.abspath(__file__))), | |
| "bot.db" | |
| ) | |
| def get_conn() -> sqlite3.Connection: | |
| conn = sqlite3.connect(DB_PATH, timeout=30, check_same_thread=False) | |
| conn.execute("PRAGMA journal_mode=WAL") | |
| conn.execute("PRAGMA cache_size=-32768") | |
| conn.execute("PRAGMA synchronous=NORMAL") | |
| conn.execute("PRAGMA foreign_keys=ON") | |
| conn.execute("PRAGMA temp_store=MEMORY") | |
| conn.row_factory = sqlite3.Row | |
| return conn | |