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.1.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.1-py3-none-any.whl (19.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: oracle_utils-1.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 41b9a355f5912dead2884fc9287ed3738d9d6a9f56b1d99c7ccc7598d6caeb4d
MD5 5daa1ae35c636d372b1db109b68fb609
BLAKE2b-256 4f6f84da1318743d3d3a76ba595e62af78a05c48bd17b9d476dff04aa86e7b73

See more details on using hashes here.

File details

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

File metadata

  • Download URL: oracle_utils-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 19.7 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 286b128cc3e6567f34eba844283843d2b7f255bdd67bf8290f3e878df26e605e
MD5 52cff0f35af109f3eff1d42fa4864fe2
BLAKE2b-256 044f26573dd615b6f1ee023bae9542882207c3b3d0cfd86cd0c35755f8d32bdf

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