mirror of
https://github.com/bluerelay/windyquery.git
synced 2021-05-12 21:52:11 +03:00
add install_requires
This commit is contained in:
7
.gitignore
vendored
7
.gitignore
vendored
@@ -250,3 +250,10 @@ __pycache__/
|
||||
.pytest_cache/
|
||||
.env
|
||||
.vscode/settings.json
|
||||
|
||||
# Setuptools distribution folder.
|
||||
/dist/
|
||||
/build/
|
||||
|
||||
# Python egg metadata, regenerated from source files by setuptools.
|
||||
/*.egg-info
|
||||
53
README.md
53
README.md
@@ -1,3 +1,54 @@
|
||||
# windyquery - A non-blocking Python PostgreSQL query builder
|
||||
|
||||
Windyquery is a non-blocking PostgreSQL query builder with Asyncio.
|
||||
Windyquery is a non-blocking PostgreSQL query builder with Asyncio.
|
||||
|
||||
### Installation
|
||||
```
|
||||
$ pip install windyquery
|
||||
```
|
||||
|
||||
### Connection
|
||||
```
|
||||
import asyncio
|
||||
|
||||
from windyquery import DB, Schema
|
||||
|
||||
# create DB connection for CRUD operatons
|
||||
db = DB()
|
||||
asyncio.get_event_loop().run_until_complete(db.connect('db_name', {
|
||||
'host': 'localhost',
|
||||
'port': '5432',
|
||||
'database': 'db_name',
|
||||
'username': 'db_user_name',
|
||||
'password': 'db_user_password'
|
||||
}, default=True))
|
||||
|
||||
# create DB connection for migration operations
|
||||
schema = Schema()
|
||||
asyncio.get_event_loop().run_until_complete(schema.connect('db_name', {
|
||||
'host': 'localhost',
|
||||
'port': '5432',
|
||||
'database': 'db_name',
|
||||
'username': 'db_user_name',
|
||||
'password': 'db_user_password'
|
||||
}, default=True, min_size=1, max_size=1))
|
||||
```
|
||||
|
||||
### CRUD operations
|
||||
```
|
||||
# SELECT
|
||||
result = await db.table('users').select().first()
|
||||
result['name']
|
||||
|
||||
# INSERT
|
||||
await db.table('users').insert(
|
||||
{'email': 'test1@example.com', 'password': 'my precious'},
|
||||
{'email': 'test2@example.com', 'password': 'my precious'}
|
||||
)
|
||||
|
||||
# UPDATE
|
||||
await db.table('users').where('id', 2).update({'name': 'new name'})
|
||||
|
||||
# DELETE
|
||||
await db.table('users').where('id', 2).delete()
|
||||
```
|
||||
4
setup.py
4
setup.py
@@ -13,6 +13,10 @@ setuptools.setup(
|
||||
long_description_content_type="text/markdown",
|
||||
url="https://github.com/bluerelay/windyquery",
|
||||
packages=setuptools.find_packages(),
|
||||
install_requires=[
|
||||
'asyncpg',
|
||||
'rx',
|
||||
],
|
||||
classifiers=[
|
||||
"Programming Language :: Python :: 3.6",
|
||||
"License :: OSI Approved :: MIT License",
|
||||
|
||||
Reference in New Issue
Block a user