Skip to main content

Split Oracle SQL and PL/SQL scripts into executable statements.

Project description

oracle-sql-splitter

Small Python library and CLI for splitting Oracle SQL and PL/SQL scripts into executable statements.

Features

  • Splits regular SQL statements terminated by ;
  • Keeps Oracle PL/SQL blocks together until a standalone /
  • Skips common SQL*Plus directives such as SET SERVEROUTPUT ON
  • Preserves comments and blank lines that belong to a statement
  • Exposes both a Python API and a CLI
  • Includes GitHub Actions for CI and PyPI publishing

Install

pip install oracle-sql-splitter

Python usage

from oracle_sql_splitter import split_sql

sql = """
SET SERVEROUTPUT ON
CREATE TABLE demo (id NUMBER);
BEGIN
  NULL;
END;
/
"""

parts = split_sql(sql)
for part in parts:
    print("---")
    print(part)

CLI usage

Split a file:

oracle-sql-splitter path/to/script.sql

Read from stdin:

type script.sql | oracle-sql-splitter --stdin

Print as JSON:

oracle-sql-splitter path/to/script.sql --json

Development

python -m pip install -e .[dev]
pytest
python -m build
python -m twine check dist/*

GitHub Actions

  • .github/workflows/ci.yml runs tests and package build checks
  • .github/workflows/publish.yml publishes to PyPI via trusted publishing on GitHub Releases

Publish to PyPI

See RELEASE.md for the full release checklist.

Quick summary:

  1. Confirm the package name oracle-sql-splitter is still available on PyPI, or rename it before the first release.
  2. Bump version in pyproject.toml.
  3. Build and validate distributions locally.
  4. Publish to TestPyPI first if you want a dry run.
  5. Publish to PyPI either manually with twine or by creating a GitHub release after configuring trusted publishing.

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

oracle_sql_splitter-0.1.0.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

oracle_sql_splitter-0.1.0-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file oracle_sql_splitter-0.1.0.tar.gz.

File metadata

  • Download URL: oracle_sql_splitter-0.1.0.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for oracle_sql_splitter-0.1.0.tar.gz
Algorithm Hash digest
SHA256 002f37861a4bd14c15f7b018d4ed4281d7a157f993a13c806c3fb50110588192
MD5 c7e234bc997d6f32d48e03d5aa6d7110
BLAKE2b-256 c0df746af6ae22010ea6716434e0563fd2363603eb9caeadd6b0ffb5088853e8

See more details on using hashes here.

Provenance

The following attestation bundles were made for oracle_sql_splitter-0.1.0.tar.gz:

Publisher: publish.yml on ob-server83/oracle-sql-splitter

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file oracle_sql_splitter-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for oracle_sql_splitter-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1ed4fab702d5fba76dffac773ef23dacb15138072825ebf04dde740855feb4bb
MD5 edcbeed019dd7919ba33cac83d57ff52
BLAKE2b-256 fdc7eb752d8100e1c519fad105b4b11a4a24f9edca0d012e99928e62c85d5ef9

See more details on using hashes here.

Provenance

The following attestation bundles were made for oracle_sql_splitter-0.1.0-py3-none-any.whl:

Publisher: publish.yml on ob-server83/oracle-sql-splitter

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page