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 details)
File details
Details for the file sql-annotation-1.0.0.tar.gz
.
File metadata
- Download URL: sql-annotation-1.0.0.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: Python-urllib/2.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 575a985bce4603144e594653fd6b2eda034b346e68bba100ad2c8fe794a4e480 |
|
MD5 | c06af9a3865f0d3bf09a1b37f143d03a |
|
BLAKE2b-256 | d688d1aa4b0096e8d27188584707cc11858801ec01b378f7adbc785f1b87fe38 |