|
| 1 | +(queryzen)= |
| 2 | +# QueryZen |
| 3 | + |
| 4 | +:::{rubric} About |
| 5 | +::: |
| 6 | + |
| 7 | +[QueryZen] makes it easier to manage SQL query statements over HTTP. |
| 8 | + |
| 9 | +A `Zen` in QueryZen jargon is a named, parameterized, and versioned SQL query |
| 10 | +that is created, updated, and executed over HTTP endpoints. It allows you to |
| 11 | +decouple SQL from your application while controlling, versioning, and securing |
| 12 | +data access from development to production. |
| 13 | + |
| 14 | +{w=700px} |
| 15 | + |
| 16 | +:::{rubric} Features |
| 17 | +::: |
| 18 | + |
| 19 | +Overview: |
| 20 | + |
| 21 | +* Create, get and delete Zens in different collections and run them in different databases. |
| 22 | +* Automatically version queries, name and safely parameterize queries with special functions. |
| 23 | +* High test coverage. |
| 24 | +* Track, save and analyze statistics of your queries over time and versions. |
| 25 | +* Everything is dockerized for easy development and deployment. |
| 26 | + |
| 27 | +QueryZen includes: |
| 28 | + |
| 29 | +* HTTP REST backend to handle the lifecycle of Zens. |
| 30 | +* Task execution backend to handle the execution of the queries. |
| 31 | +* Database driver abstraction for Python SQL drivers. |
| 32 | +* Pythonic package to programmatically use QueryZen. |
| 33 | + |
| 34 | +With QueryZen you can: |
| 35 | + |
| 36 | +* Quickly create HTTP REST endpoints of your SQL data. |
| 37 | +* Integrate your SQL data in your data pipelines with minimal configuration. |
| 38 | +* Monitor individual query executions and analyze metrics. |
| 39 | +* Version your SQL queries, build and test queries without affecting production. |
| 40 | +* Create materialized views for SQL databases that do not support them. |
| 41 | + |
| 42 | +:::{rubric} Synopsis |
| 43 | +::: |
| 44 | + |
| 45 | +```python |
| 46 | +from queryzen import QueryZen |
| 47 | + |
| 48 | +qz = QueryZen() |
| 49 | + |
| 50 | +# Default collection is 'main' and the version is 'latest'. |
| 51 | +qz.create("mountains", query="SELECT * FROM sys.summits WHERE country = :country AND height > :height") |
| 52 | + |
| 53 | +# If no version is specified, it returns 'latest'. |
| 54 | +zen = qz.get("mountains", collection="main") |
| 55 | +print(zen) |
| 56 | + |
| 57 | +# Invoke with default values. |
| 58 | +result = qz.run(zen) |
| 59 | + |
| 60 | +print(result.has_data) |
| 61 | +print(result.as_table()) |
| 62 | +``` |
| 63 | + |
| 64 | +:::{rubric} Resources |
| 65 | +::: |
| 66 | + |
| 67 | +- [Documentation](https://qz.surister.dev/.) |
| 68 | +- [Client Package](https://pypi.org/project/queryzen/) |
| 69 | +- [Server OCI](https://hub.docker.com/r/surister/queryzen_api) |
| 70 | +- [Source Repository](https://github.com/surister/queryzen) |
| 71 | + |
| 72 | + |
| 73 | +[QueryZen]: https://github.com/surister/queryzen |
0 commit comments