Skip to main content

A simple database manager with sqlalchemy

Project description

A simple database manager with sqlalchemy

Installation

python3 -m pip install sql_manager

Basic Usage

from sqlalchemy import Column, Integer
from sql_manager import DynamicModel, Manager

# create model
columns = {
    'uid': Column(Interger, primary_key=True),
    'name': Column(String(10), comment='the username')}
Base, Data = DynamicModel('TEST', columns, 'test')

# insert data
with Manager(Base, dbfile='test.db') as m:
    data = Data(uid=1, name='zoro')
    m.insert(Data, 'uid', data)

# query, delete
with Manager(Base, dbfile='test.db') as m:
    res = m.query(Data, 'uid', 1)
    print(res.all())
    m.delete(Data, 'uid', 1)    

# other origin methods
with Manager(Base, dbfile='test.db') as m:
    query = m.session.query(Data)
    query.filter(Data.name.like('%zo%')).limit(1)

Document

https://sql-manager.readthedocs.io/en/latest/

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

sql_manager-1.0.2.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

sql_manager-1.0.2-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file sql_manager-1.0.2.tar.gz.

File metadata

  • Download URL: sql_manager-1.0.2.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.8

File hashes

Hashes for sql_manager-1.0.2.tar.gz
Algorithm Hash digest
SHA256 e226b695e14bbea7c87c7ab89358de839123eb878455ea2df0b5a6458245e13a
MD5 5e5683db3ba1755424e65d918a6e7acb
BLAKE2b-256 b7438e08bd11ba823484653e589f07c71c60593f30795cec016ab93ecf0d825b

See more details on using hashes here.

File details

Details for the file sql_manager-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: sql_manager-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.8

File hashes

Hashes for sql_manager-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0ed631125df5dcd4eee2d07cbf633a46696c595510bc166bfd2b3b49007f3b2e
MD5 30981f9f1dfd4ee27f953db0e6c72e2c
BLAKE2b-256 d2dbebb834e8299728be9ff0c93d9a2a0e9eb2cd6d516bdddc4601da5a028091

See more details on using hashes here.

Supported by

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