Skip to main content

Install '''''''

.. code:: shell

pip install sqlormx_generator

Usage Sample ''''''''''''

.. code:: python

   from sqlormx_generator import Generator

   if __name__ == '__main__':
       coder = Generator(host='127.0.0.1', port='3306', user='xxx', password='xxx', database='test')
       # you can generate a model class for one table
       coder.generate_with_tables(tables='user', path='models.py')
       # you can generate model classes for tables
       coder.generate_with_tables(tables=['user', 'person'], path='models.py')
       # you can generate model classes for all tables from a given schema. default current schema if not given
       coder.generate_with_schema(schema='test', path='models.py')

If you run last code, then generate a file 'models.py' in current directory like follow:

.. code:: python

   from decimal import Decimal
   from dataclasses import dataclass
   from datetime import date, datetime
   from sqlormx import Model

   @dataclass
   class BaseModel(Model):
       id: int = None
       create_by: int = None
       create_time: datetime = None
       update_by: int = None
       update_time: datetime = None
       del_flag: int = None


   @dataclass
   class User(BaseModel):
       __table__ = 'user'
       name: str = None
       age: int = None
       birth_date: date = None
       sex: int = None

SQLORMX: https://pypi.org/project/sqlormx

Metadata

Release files for sqlormx-generator 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sqlormx-generator 0.1.0
File Size Uploaded Provenance Actions
sqlormx_generator-0.1.0.tar.gz 9.8 kB Without provenance Details for sqlormx_generator-0.1.0.tar.gz

Release files / sqlormx_generator-0.1.0.tar.gz

Download URL sqlormx_generator-0.1.0.tar.gz
Size 9.8 kB
Tags Source
SHA-256 checksum
How to use checksums
0e4360f0e88259b9345fb646daaeb70b33edcd68549a9deb45aa5ee0bb9d1ff5
BLAKE2b-256 checksum
How to use checksums
61ae46a54ad97c86bb77fe8edddeabd636de80df11f450265057ce025fad613a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.9.18

Security for sqlormx-generator 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page