Skip to main content

A Python tool to process SQL*Plus scripts, resolving file inclusions (@, @@) and variable substitutions (DEFINE/UNDEFINE)

Project description

MergeSourceFile

A Python tool to process SQL*Plus scripts, resolving file inclusions and variable substitutions.

Descripción

Este es un proyecto Python que incluye un script capaz de procesar scripts de SQL*Plus. El programa resuelve las inclusiones de archivos referenciados mediante @ y @@, realiza sustituciones de variables definidas con DEFINE, soporta la eliminación de variables con UNDEFINE, y permite la redefinición de variables a lo largo del script.

Features

  • File Inclusion Resolution: Processes @ and @@ directives to include external SQL files
  • Variable Substitution: Handles DEFINE and UNDEFINE commands for variable management
  • Variable Redefinition: Supports redefining variables throughout the script
  • Tree Display: Shows the inclusion hierarchy in a tree structure
  • Verbose Mode: Detailed logging for debugging and understanding the processing flow

Installation

pip install MergeSourceFile

Usage

Command Line

mergesourcefile --input input.sql --output output.sql

Options

  • --input, -i: Input SQL*Plus file to process (required)
  • --output, -o: Output file where the result will be written (required)
  • --skip-var, -sv: Skip variable substitution, only resolve file inclusions
  • --verbose, -v: Enable verbose mode for detailed processing information

Examples

  1. Process a SQL file with full processing:

    mergesourcefile -i main.sql -o merged.sql
    
  2. Process only file inclusions, skip variable substitution:

    mergesourcefile -i main.sql -o merged.sql --skip-var
    
  3. Process with verbose output:

    mergesourcefile -i main.sql -o merged.sql --verbose
    

How It Works

File Inclusion

  • @filename: Includes a file relative to the original base path
  • @@filename: Includes a file relative to the current file's directory

Variable Substitution

  • DEFINE varname = 'value';: Defines or redefines a variable
  • &varname: References a variable for substitution
  • &varname..: Variable concatenation with period
  • UNDEFINE varname;: Removes a variable definition

License

MIT License - see LICENSE file for details.

Author

Alejandro G.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

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

mergesourcefile-1.0.0.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

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

mergesourcefile-1.0.0-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file mergesourcefile-1.0.0.tar.gz.

File metadata

  • Download URL: mergesourcefile-1.0.0.tar.gz
  • Upload date:
  • Size: 9.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for mergesourcefile-1.0.0.tar.gz
Algorithm Hash digest
SHA256 90cd85709d5602c283ab993446977e94af0d733aba8acd58a055e406df811b4c
MD5 7d11a135d88f5dfe1772850149b5538f
BLAKE2b-256 c960ef95ab6c9f859b25c4db468f2d710232642d879bfa6d5512b38233a00d25

See more details on using hashes here.

File details

Details for the file mergesourcefile-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for mergesourcefile-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 75cc19f75983d07204c7a8ded5351c7bd4f2eb05d88e534f70fed9b9570577ec
MD5 25af78981b0e25c601ed5a9d3f48cbb7
BLAKE2b-256 33d262ac54bb1d76273d28f4edbc366b3a32a4d8a3147f6e9b5056e440136eb8

See more details on using hashes here.

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