https://github.com/dancardin/query
SQL Query builder
https://github.com/dancardin/query
Last synced: 6 days ago
JSON representation
SQL Query builder
- Host: GitHub
- URL: https://github.com/dancardin/query
- Owner: DanCardin
- License: apache-2.0
- Created: 2015-11-20T18:19:38.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-11-25T22:03:04.000Z (over 10 years ago)
- Last Synced: 2025-01-29T17:44:40.608Z (over 1 year ago)
- Language: Python
- Homepage:
- Size: 7.81 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
SQL Query Builder
---
This modules defines a class which allow the building of SQL queries in a functional style.
This class lazily builds SQL queries. Each method called on the class returns another `Query` object which will only get evaluated once the `build` method is called.
Example:
```python
q = Query('Person').select('id', 'age')
filtered = q.filter(name='Bill')
name_ordered = (filtered
.select('name')
.order_by('name')
.build()
)
age_ordered = filtered.order_by('age').build()
name_ordered == 'SELECT id, age, name FROM Person where name='Bill' ORDER BY name;'
age_ordered == 'SELECT id, age FROM Person where name='Bill' ORDER BY age;'
```