ersatz-table-valued-functions
A bad idea.
ersatz (adj.): made or used as a substitute, typically an inferior one, for something else.
Installation
Install this library using pip:
pip install ersatz-table-valued-functions
Usage
This library lets you rewrite queries like:
SELECT root, square FROM tbl_squares(3)
into queries like:
WITH _ersatz_1 AS (
SELECT
JSON_EXTRACT(value, '$[0]') AS "root",
JSON_EXTRACT(value, '$[1]') AS "square"
FROM JSON_EACH((SELECT tbl_squares(3)))
)
SELECT root, square FROM _ersatz_1
That is: it translates a query that looks like it needs a table-valued function into one that uses a scalar-valued function that returns a JSON 2D array.
To use it:
from ersatz_table_valued_functions import rewrite
rewrite('SELECT root, square FROM tbl_squares(3)', { 'TBL_SQUARES': ['root', 'square'] })
Development
To contribute to this library, first checkout the code. Then create a new virtual environment:
cd ersatz-table-valued-functions
python -m venv venv
source venv/bin/activate
Now install the dependencies and test dependencies:
pip install -e '.[test]'
To run the tests:
pytest
Metadata
Release files for ersatz-table-valued-functions 0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ersatz-table-valued-functions-0.2.tar.gz | 7.3 kB | Without provenance | Details for ersatz-table-valued-functions-0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ersatz_table_valued_functions-0.2-py3-none-any.whl | Python 3 | none | any | Details for ersatz_table_valued_functions-0.2-py3-none-any.whl |
Total release size: 15.0 kB
Release files / ersatz-table-valued-functions-0.2.tar.gz
| Download URL | ersatz-table-valued-functions-0.2.tar.gz |
|---|---|
| Size | 7.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2247eed8c7784aaee28b1f1ccaa2618d9bc17b222493e416389f2e796fdacd17
|
|
BLAKE2b-256 checksum How to use checksums |
64495d87e3019503ed984b6b3f055ed9cde4b95478257afbd42cf7c6230b1018
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.1
|
Release files / ersatz_table_valued_functions-0.2-py3-none-any.whl
| Download URL | ersatz_table_valued_functions-0.2-py3-none-any.whl |
|---|---|
| Size | 7.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b58a91ea72007e89d58c282bc2915d2955415279152fffe6f63831bc7ed0000e
|
|
BLAKE2b-256 checksum How to use checksums |
5a095efd964cc057b3acc804cb8ff55fb4f45c644308856e802e80a138911292
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.1
|
Security for ersatz-table-valued-functions 0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.