Skip to main content

a lite mysql & sqlite3 connect engine, mapping table into k-v structure

Project description

a lite mysql & sqlite3 connect engine… Name from the Lord of Ring

<=========how to use=========>

from anduin.river import Ring

configuration setting:
db_config = {‘host’: mysql host,

‘user’: username,

‘password’: password,

‘database’: database name,

‘port’: port,

‘engine’:’mysql’}

then use Ring.init(db_config) to init the connection

now enjoy it!!

or you can put a config file in config/db_config.py , write the dict in it

cond = [

(col1,’=’,val1), (col2,’=’,val2), ….]

fields = [

col1, col2 …]

params = {

key1:val1, key2:val2, …}

find one line of data:

Ring.find(__TableName__,conditions=cond,fields=fields)

return a python dict like { col1:value1,col2:value2…}

find datas

Ring.select(__TableName__,conditions=cond,fields=fields)

return a python list like [{ col1:value1,col2:value2…}]

update data:

Ring.update(__TableName__,conditions=cond,params=params)

return None

insert data:

Ring.insert(__TableName__,params=params)

return None

delete data:

Ring.delete(__TableName__,conditions=cond)

return None

using Ring.query() to execute sql directly like Ring.query(‘select * from table’)

all of these executions will have auto commit

or you can do like

from anduin.river import Ring

db_manager = Ring.Base_pool[‘default’] sql = db_manager.find_free_sql()

sql.update(‘user’,cond,or_cond=None,params=params ) sql.insert(‘user’,params=params ) sql.delete(‘user’,cond,or_cond=None)

sql.commit()

to choose a certain sql connection to execute

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

anduin-1.9.5.tar.gz (10.8 kB view details)

Uploaded Source

File details

Details for the file anduin-1.9.5.tar.gz.

File metadata

  • Download URL: anduin-1.9.5.tar.gz
  • Upload date:
  • Size: 10.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.0

File hashes

Hashes for anduin-1.9.5.tar.gz
Algorithm Hash digest
SHA256 29cd526af7967d4dda43b3a49dca42512f58305e2e1cafc372818bd99e6c4f4a
MD5 4125b43f5fe7938b00c72de2b331ce8c
BLAKE2b-256 7ddfbdc1a1f2ab8e9286fc1c67a1dd3f9bb0c17059b1d69d5562c8c77e8f13c3

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