antlr-plsql
Development
ANTLR requires Java, so we suggest you use Docker when building grammars. The Makefile contains directives to clean, build, test and deploy the ANTLR grammar. It does not run Docker itself, so run make inside Docker.
Build the grammar
# Build the docker container
docker build -t antlr_plsql .
# Run the container to build the python grammar
# Write parser files to local file system through volume mounting
docker run -it -v ${PWD}:/usr/src/app antlr_plsql make build
Set up the Python module
Now that the Python parsing files are available, you can install them with pip:
pip install -r requirements.txt
pip install -e .
And parse SQL code in Python:
from antlr_plsql import ast
ast.parse("SELECT a from b")
Using the AST viewer
If you're actively developing on the ANLTR grammar or the tree shaping, it's a good idea to set up the AST viewer locally so you can immediately see the impact of your changes in a visual way.
- Clone the ast-viewer repo and build the Docker image according to the instructions.
- Spin up a docker container that volume mounts the Python package, symlink-installs the package and runs the server on port 3000:
docker run -it \
-u root \
-v ~/workspace/antlr-plsql:/app/app/antlr-plsql \
-p 3000:3000 \
ast-viewer \
/bin/bash -c "echo 'Install development requirements in development:' \
&& pip install --no-deps -e app/antlr-plsql \
&& python3 run.py"
When simultaneously developing other packages, volume mount and install those too:
docker run -it \
-u root \
-v ~/workspace/antlr-ast:/app/app/antlr-ast \
-v ~/workspace/antlr-plsql:/app/app/antlr-plsql \
-v ~/workspace/antlr-tsql:/app/app/antlr-tsql \
-p 3000:3000 \
ast-viewer \
/bin/bash -c "echo 'Install development requirements in development:' \
&& pip install --no-deps -e app/antlr-ast \
&& pip install --no-deps -e app/antlr-plsql \
&& pip install --no-deps -e app/antlr-tsql \
&& python3 run.py"
- If you update the tree shaping logic in this repo, the app will auto-update.
- If you change the grammar, you will have to first rebuild the grammar (with the
antlr_plsqldocker image) and restart theast-viewercontainer.
Run tests
# Similar to building the grammar, but running tests
# and not saving the generated files
docker build -t antlr_plsql .
docker run -t antlr_plsql make build test
Or run the test locally, first build the grammar then run:
pytest
Travis deployment
- Builds the Docker image.
- Runs the Docker image to build the grammar and run the unit tests.
- Deploys the resulting python files to PyPi when a new release is made, so they can be installed easily.
Metadata
Release files for antlr-plsql 0.9.1
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 |
|---|---|---|---|---|
| antlr-plsql-0.9.1.tar.gz | 622.3 kB | Without provenance | Details for antlr-plsql-0.9.1.tar.gz |
Release files / antlr-plsql-0.9.1.tar.gz
| Download URL | antlr-plsql-0.9.1.tar.gz |
|---|---|
| Size | 622.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5bef8261031239176d483005fa5764eb6cafa6c7826d398f3e84d17038f88730
|
|
BLAKE2b-256 checksum How to use checksums |
3a546d96bdfbd5dee02533992fa60ec8ac53040470f2d1c4a2f751f9c8e33329
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.5.6
|
Security for antlr-plsql 0.9.1
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.