Database Annotation, author liyuanjun
Project description
# sql-annotation
> 使用装饰器的方式来执行sql操作.
# Install
* pip: `$ pip install sql-annotation`
* source:
* `$ git clone https://github.com/tomoncle/sql-annotation.git`
* `$ cd sql-annotation`
* `$ python setup.py`
# example:
```python
from sql_annotation.annotation import select
from sql_annotation.conn import connection
connection(username='tom', password='123456', db='test')
@select('select * from t_school WHERE id="#{id}"')
def get_school_by_id(id):
pass
@select('select * from t_school WHERE name like "%#{name}%"')
def get_school_by_name(name):
pass
print get_school_by_id(id='60')
print get_school_by_name(name='乌克兰')
```
> 使用装饰器的方式来执行sql操作.
# Install
* pip: `$ pip install sql-annotation`
* source:
* `$ git clone https://github.com/tomoncle/sql-annotation.git`
* `$ cd sql-annotation`
* `$ python setup.py`
# example:
```python
from sql_annotation.annotation import select
from sql_annotation.conn import connection
connection(username='tom', password='123456', db='test')
@select('select * from t_school WHERE id="#{id}"')
def get_school_by_id(id):
pass
@select('select * from t_school WHERE name like "%#{name}%"')
def get_school_by_name(name):
pass
print get_school_by_id(id='60')
print get_school_by_name(name='乌克兰')
```
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
sql-annotation-1.0.0.tar.gz
(3.3 kB
view hashes)