Organize app queries in an annotated SQL file.
Project description
Query selector allows one treat a file full of SQL queries as a record, with one attribute for each annotated query. This makes working with long, ad-hoc SQL queries more hygienic, and has the benefit of making it easy to find the queries.
The QuerySelector constructor accepts a string, file handle or (<package>, <resource) pair and parses the SQL into groups annotated with --@ <name> <mode>. The <name> is any Python compatible name; it will become an attribute of the object. The <mode> is merely metadata, and can be omitted; it describes whether a query should have one, none or many results.
For example, a file like this:
--@ t one
SELECT * FROM now();
becomes an object with a single attribute t:
>>> q.t
Query(args=[], mode=u'one', text=u'SELECT * FROM now();')
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file query-selector-0.99.0.tar.gz
.
File metadata
- Download URL: query-selector-0.99.0.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
11a3b1ee9ba3a2c0eccc8f647e4ea162ead73c43f420e267b894acda4d16d74c
|
|
MD5 |
709ed939270b9608ea4a206b1d317383
|
|
BLAKE2b-256 |
8a90347a7f836579b02e44347a17df793cbf60a97340f1bc6b5a33aa5615a699
|