Small SQL helper utilities with optional external authsql.py config loading.
Project description
toolssql
Small SQL helper utilities (MySQL-focused) with flexible auth configuration.
Install
pip install toolssql
Auth config loading
This package will try to load CONNECTION_CONFIG and CONNECTION_CONFIG_DEFAULT
from an authsql.py module/file in this order:
AUTHSQL_MODULEenv var (importable module path, e.g.myapp.authsql)- Import
authsql(works when your project root is onsys.path) AUTHSQL_PATHenv var pointing directly to anauthsql.pyfile (supports~and$HOME)- Home directory fallbacks:
~/authsql.py~/.authsql.py~/.config/authsql.py
Example config:
from typing import Dict, Any
CONNECTION_CONFIG: Dict[str, Any] = {
'config1':
{
'host': 'localhost',
'user': 'Analyst',
'password': 'XXXXXXXXXXXXXXXXX',
'database': 'Playground',
},
'config2':
{
'host': 'localhost',
'user': 'Analyst2',
'password': 'XXXXXXXXXXXXXXXXX',
},
}
# default connection to be used, if nothing else is specified
CONNECTION_CONFIG_DEFAULT = "config1"
If none are found, it falls back to {} / None.
Important: Do not ship secrets inside this PyPI package. Keep authsql.py outside git.
Usage
from toolssql import MysqlConnect
db = MysqlConnect() # uses loaded defaults if available
df = db.select_df("SELECT 1 AS one")
print(df)
Or inject config explicitly:
from toolssql import MysqlConnect
cfg = {
"prod": {"host": "...", "user": "...", "password": "...", "database": "..."}
}
db = MysqlConnect(connection="prod", connection_config=cfg, connection_default="prod")
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
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
File details
Details for the file toolssql-0.1.0.tar.gz.
File metadata
- Download URL: toolssql-0.1.0.tar.gz
- Upload date:
- Size: 9.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b69ec2eec0385454aac94e30f2a46b10fd591068a203d1a9d6b9005c633faca0
|
|
| MD5 |
d4b24b2204e0b19a91f72d93a8e90054
|
|
| BLAKE2b-256 |
08d5d7816d21b7046ac101e5feb22cc4fc2da5ebaf25cc8119651f76beb242a6
|
File details
Details for the file toolssql-0.1.0-py3-none-any.whl.
File metadata
- Download URL: toolssql-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.3 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 |
772ba28457dfaa8d86c6d505ca4aa7ce19090c85ce4467b479d4ee705ac4ca32
|
|
| MD5 |
2776837dedaea9ab94ed01b3b7e20049
|
|
| BLAKE2b-256 |
630fb9345c8734668b990422c2bf98ea573d7b133c51e44997b29a78290ac7ac
|