A auto maping ORM for MYSQL and can bind with memcached
Project description
from sqlbean.db.sqlstore import SqlStore
#tables can in different databases
DATABASE_CONFIG = {
"mokodb": {
"master": "localhost:3306:mokodb:root:111111",
"tables": ["*", "user"],
},
}
SQLSTORE = SqlStore(db_config=DATABASE_CONFIG, **{})
def get_db_by_table(table_name):
return SQLSTORE.get_db_by_table(table_name)
from sqlbean.db import connection
connection.get_db_by_table = get_db_by_table
from sqlbean.shortcut import Model
# will auto mapping the table structure
# class User will mapping to user
# class UserProfile will mapping to user_profile and so on
class User(Model):
pass
for i in User.where():
print i.id
# more useage please the source code :)
#tables can in different databases
DATABASE_CONFIG = {
"mokodb": {
"master": "localhost:3306:mokodb:root:111111",
"tables": ["*", "user"],
},
}
SQLSTORE = SqlStore(db_config=DATABASE_CONFIG, **{})
def get_db_by_table(table_name):
return SQLSTORE.get_db_by_table(table_name)
from sqlbean.db import connection
connection.get_db_by_table = get_db_by_table
from sqlbean.shortcut import Model
# will auto mapping the table structure
# class User will mapping to user
# class UserProfile will mapping to user_profile and so on
class User(Model):
pass
for i in User.where():
print i.id
# more useage please the source code :)
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
sqlbean-0.512.tar.gz
(17.2 kB
view details)
File details
Details for the file sqlbean-0.512.tar.gz.
File metadata
- Download URL: sqlbean-0.512.tar.gz
- Upload date:
- Size: 17.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
425efeb26f9e5579832100ecd7b81ad84bd2eb85009151be9598a5a187444419
|
|
| MD5 |
694347be6be4e7402fb1b7992ccc673c
|
|
| BLAKE2b-256 |
102643cf134054d76a5d58d8b4819430fd196dbc36677a50b19a8084eb5755f2
|