Skip to main content

Oracle SQLPlus Automation for Database Scripting

Project description

oracle_utils: local sqlplus query module

Python module to automate the interaction with sqlplus for database scripting. It is designed to connect to a local database instance as defined by the ORACLE_SID environment variable.

The sqlplus program is called once and run in a subprocess so multiple queries can be quickly run. Performance is much better than Bash with cat <<EOF for integrating database data into scripts. The query results are returned in JSON format.

Example

from oracle_utils import Sqlplus
import json

sql_session = Sqlplus()
sql_session.start()
result = sql_session.run_query('select * from dual;')
print(json.dumps(result, indent=4))
sql_session.end()

You can pass a query to the module if you want to only execute one query and output the results to the terminal:

Sqlplus(query="select * from v$instance;")

This also enables a Bash one-linter to run a quick query:

python -c "from oracle_utils import Sqlplus; Sqlplus(query='select * from v\$instance;')"

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_utils-1.1.0.tar.gz (17.5 kB view details)

Uploaded Source

Built Distribution

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

oracle_utils-1.1.0-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file oracle_utils-1.1.0.tar.gz.

File metadata

  • Download URL: oracle_utils-1.1.0.tar.gz
  • Upload date:
  • Size: 17.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Hatch/1.16.2 cpython/3.12.10 HTTPX/0.28.1

File hashes

Hashes for oracle_utils-1.1.0.tar.gz
Algorithm Hash digest
SHA256 60aac820e5dcb970ac17931cc9389f1bf174af284732ce282b878abdd9efe538
MD5 651cceb6913d36eec866a4e6287d2cab
BLAKE2b-256 7aa1540e7771e1d02eb6ebbcd10ebd2fd672aaf4c6f7fe504d29373a0afe5568

See more details on using hashes here.

File details

Details for the file oracle_utils-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: oracle_utils-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Hatch/1.16.2 cpython/3.12.10 HTTPX/0.28.1

File hashes

Hashes for oracle_utils-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bff5ebe72b83b4e47dd81f7726288d8c52e8e67e13df8cce01193f7dae86e7b7
MD5 80ee97fce9a3e1dc7e95543a1778ff9d
BLAKE2b-256 e8cb8fd25e839b82a4140b0cc39bc4acd26be63e0e6e674a19bd9345a1f1f5cb

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