Skip to main content

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 engine
  • session(engine_session): Creates database session
  • base(): Returns a declarative base
  • metadata(base, engine): Creates database tables
  • add_commit(session, user): Adds and commits objects to database
  • _Column(*args, **kwargs): Column creator helper
  • Integer(): Creates Integer column type
  • String(length): Creates String column type

dataTool

File and utility operations class.

Methods:

  • dell(file): Deletes specified file
  • read_data(session, model): Reads and prints all records from model
  • connet(file, name): Creates and writes to a file
  • email_send(subject, to, from_): Creates email message
  • _inter(app_name, route, db_path): Creates Flask interface for database
  • create_template(template_dir): Creates default data view template
  • ensure_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 application
  • route: URL endpoint for the data view (e.g., '/data')
  • db_path: Path to your SQLite database file
  • port: (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:

  1. Checks for template directory
  2. Creates template directory if missing
  3. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xdatool-0.1.0.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xdatool-0.1.0-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

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

Hashes for xdatool-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a841e85c1c49923f4fcbe58bc7daec7ac6fe8ec8c0d0af52c933e8507d928995
MD5 acb315d0c5daedc6b2f998910a2b1012
BLAKE2b-256 14b8675a520bb551a55dcd27930cfc9ad2423d1289ddb3c1920cde289e0a6cb2

See more details on using hashes here.

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

Hashes for xdatool-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2ccfdbb229610f7b824ff7037f5125552e3d3bb2a4b7ba6faa15e14201641d69
MD5 233e136c28fd0c4b67a67401c7ddbca4
BLAKE2b-256 f6f097b2e42f162580b15e07f1edb5a5ec0842d0d3066c7c5b31df5d3da9edbe

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page