Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kaaass/sqlite_queue_python
A simple sqlite queue with a SQL statement encapsulation.
https://github.com/kaaass/sqlite_queue_python
python-library sqlite
Last synced: 5 days ago
JSON representation
A simple sqlite queue with a SQL statement encapsulation.
- Host: GitHub
- URL: https://github.com/kaaass/sqlite_queue_python
- Owner: kaaass
- License: gpl-2.0
- Created: 2017-10-15T02:06:12.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2017-10-15T03:51:44.000Z (about 7 years ago)
- Last Synced: 2023-03-02T22:41:43.759Z (over 1 year ago)
- Topics: python-library, sqlite
- Language: Python
- Homepage:
- Size: 21.5 KB
- Stars: 6
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# sqlite_queue_python
[Origin repo](https://gitee.com/kaaass/sqlite_queue_python)
A simple sqlite queue with a SQL statement encapsulation. A convenient solution of sqlite concurrency.
SqliteQueue maintains a queue of sqlite query. Support peewee request. SqlQuery contains a simple SQL statement encapsulation.
## Example
A simple queue could be created in just 2 lines.
```python
import sqlite_queuequeue = sqlite_queue.SqliteQueue('test.db')
queue.start()
```Here is a complete example.
```python
import sqlite_queuequeue = sqlite_queue.SqliteQueue('test.db')
queue.setDaemon(False) # Default a daemon thread
queue.start()# INSERT statement
for i in range(12,15):
queue.register_execute("INSERT INTO stocks VALUES ('2017-02-04','BUY','RHAT',?,35.14)", (i,)
, callback=lambda lst_row, data: print(lst_row))# SELECT statement
queue.register_execute("SELECT * FROM stocks", callback=lambda lst_row, data: print(data))# Encapsulation of SELECT statement.
queue.select('stocks').where('price', '>=', 30) \
.order('price').page(1, 5)\
.register(callback=lambda lst_row, data: print(data))
```## Installation
For python3, just run:
```
pip3 install sqlite_queue
```for other condition:
```
pip install sqlite_queue
```or you could use setup.py.
```
python setup.py install
```## TODO List
- 完成:_实现简单的SQL语句拼接_
- 完成:_实现WHERE语句拼接_
- 完成:_实现对回调函数参数的自动识别、匹配_