TOTP-based Two-Factor Authentication Library for Python
Project description
sqloader
A lightweight Python utility for managing SQL migrations and loading SQL from JSON or .sql files. Supports common relational databases and is designed for simple, clean integration with any Python backend (e.g., FastAPI).
Installation
pip install sqloader
Features
- ✅ Easy database migration management
- ✅ Load SQL queries from
.jsonor.sqlfiles - ✅ Supports MySQL and SQLite
- ✅ Clean API for integration
- ✅ Lightweight and dependency-minimized
Quickstart
from sqloader.init import database_init
config = {
"type": "mysql",
"mysql": {
"host": "localhost",
"port": 3306,
"user": "root",
"password": "pass",
"database": "mydb"
},
"service": {
"sqloder": "res/sql/sqloader/mysql"
},
"migration": {
"auto_migration": True,
"migration_path": "res/sql/migration/mysql"
},
}
db, sqloader, migrator = database_init(config)
# Example usage
query = sqloader.load_sql("user_info", "user.get_user_by_id")
result = db.fetch_one(query, ['abc', 123])
SQL Loading Behavior
- If the value in the .json file ends with .sql, the referenced file will be loaded from the same directory.
- Otherwise, the value is treated as a raw SQL string.
Example JSON file user.json:
{
"user": {
"get_user_by_id": "SELECT * FROM users WHERE id = %s",
"get_all_users": "user_all.sql"
},
"get_etc": "SELECT * FROM etc"
}
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
auth2fa-0.1.0.tar.gz
(9.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
auth2fa-0.1.0-py3-none-any.whl
(20.0 kB
view details)
File details
Details for the file auth2fa-0.1.0.tar.gz.
File metadata
- Download URL: auth2fa-0.1.0.tar.gz
- Upload date:
- Size: 9.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
edb06f89398ecc0ca1cc1d35b2544ab998b8a03cdaa6593333b96c37cee4ea03
|
|
| MD5 |
9de5b8f71a94e8763b3e3949741b4854
|
|
| BLAKE2b-256 |
1b89eaf44c842139a862ddfbb5bdd7fadc0f2b5c8c37479c41bd3aa23c8f019d
|
File details
Details for the file auth2fa-0.1.0-py3-none-any.whl.
File metadata
- Download URL: auth2fa-0.1.0-py3-none-any.whl
- Upload date:
- Size: 20.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fd84cdce731fe217115f223df4aad82cd9944a25f206220a994834daf63bc883
|
|
| MD5 |
6beca31f645d388d2071b17c7515d676
|
|
| BLAKE2b-256 |
81acfea7f613f3560b8ff97d27397dbc3756c98a98e7c6e7252c986875a61f84
|