A description of your dev key module
Project description
XDataTool Library
A Python utility library for database operations, file handling, and web interfaces.
Classes
dev
Database and ORM utility class.
Methods:
engine(engine_session): Creates a enginesession(engine_session): Creates database sessionbase(): Returns a declarative basemetadata(base, engine): Creates database tablesadd_commit(session, user): Adds and commits objects to database_Column(*args, **kwargs): Column creator helperInteger(): Creates Integer column typeString(length): Creates String column type
dataTool
File and utility operations class.
Methods:
dell(file): Deletes specified fileread_data(session, model): Reads and prints all records from modelconnet(file, name): Creates and writes to a fileemail_send(subject, to, from_): Creates email message_inter(app_name, route, db_path): Creates Flask interface for databasecreate_template(template_dir): Creates default data view templateensure_template_dir(path): Ensures template directory exists
Example Usage
from xdatatool import dev, dataTool
# Database setup
engine = dev.engine('sqlite:///database.db')
Session = dev.session(engine)
Base = dev.base()
# Define model
class User(Base):
__tablename__ = 'users'
id = dev._Column(dev.Integer(), primary_key=True)
name = dev._Column(dev.String(50))
# Create tables
dev.metadata(Base, engine)
# Web interface
app = dataTool._inter('myapp', '/data', 'database.db')
app.run(debug=True)
HTTP Interface
The _inter() method in dataTool creates a web interface to view and interact with your database records.
Parameters
app_name: Name of your Flask applicationroute: URL endpoint for the data view (e.g., '/data')db_path: Path to your SQLite database fileport: (Optional) Custom port number (default: 3000)model_path: (Optional) Path to model module (e.g., 'models.user.UserModel')model_class: (Optional) Direct model class reference
Requirements
- Flask must be installed (
pip install flask) - SQLAlchemy for database operations
Usage Examples
Basic setup with model class:
from models import UserModel
app = dataTool._inter('myapp', '/data', 'database.db', model_class=UserModel)
app.run()
Using model path:
app = dataTool._inter('myapp', '/data', 'database.db',
model_path='models.user.UserModel')
app.run()
Custom configuration:
app = dataTool._inter('myapp', '/data', 'database.db',
port=3000,
model_class=UserModel)
app.run(host='0.0.0.0') # Access from other machines
The web interface will automatically:
- Load model class from provided path or direct reference
- Connect to your database
- Display records in a formatted table view
- Handle errors gracefully with proper messages
Template Generation
The dataTool class includes built-in template generation. When _inter() is called, it automatically:
- Checks for template directory
- Creates template directory if missing
- Generates default data.html template
Example implementation:
from xdatatool import dataTool
# Templates are auto-generated on first run
app = dataTool._inter('myapp', '/data', 'database.db')
# Or explicitly create templates
dataTool.ensure_template_dir('templates')
dataTool.create_template('templates')
app.run()
DevKey
A Python module for developer key management.
Installation
pip install devkey
Usage
from devkey import main
License
MIT License
Project details
Release history Release notifications | RSS feed
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 xdatool-0.1.0.tar.gz.
File metadata
- Download URL: xdatool-0.1.0.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a841e85c1c49923f4fcbe58bc7daec7ac6fe8ec8c0d0af52c933e8507d928995
|
|
| MD5 |
acb315d0c5daedc6b2f998910a2b1012
|
|
| BLAKE2b-256 |
14b8675a520bb551a55dcd27930cfc9ad2423d1289ddb3c1920cde289e0a6cb2
|
File details
Details for the file xdatool-0.1.0-py3-none-any.whl.
File metadata
- Download URL: xdatool-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2ccfdbb229610f7b824ff7037f5125552e3d3bb2a4b7ba6faa15e14201641d69
|
|
| MD5 |
233e136c28fd0c4b67a67401c7ddbca4
|
|
| BLAKE2b-256 |
f6f097b2e42f162580b15e07f1edb5a5ec0842d0d3066c7c5b31df5d3da9edbe
|