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

import oracle_utils
import json

sql_session = oracle_utils.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:

oracle_utils.sqlplus(query="select * from v$instance;")

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

$ python -c "import oracle_utils; oracle_utils.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.0.0.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

oracle_utils-1.0.0-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: oracle_utils-1.0.0.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.20.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.6.8

File hashes

Hashes for oracle_utils-1.0.0.tar.gz
Algorithm Hash digest
SHA256 57403a2af7f7d257d271c132bc4811d2b0809a8d4a9c22bf1878cbc5afdf042e
MD5 e11fb5441cc1b2711554eb6a3e3da793
BLAKE2b-256 7e0ad4f0d1bc874700ffa6c7567b602552409f331b41a8ac14d5e331b2fa0e81

See more details on using hashes here.

File details

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

File metadata

  • Download URL: oracle_utils-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.20.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.6.8

File hashes

Hashes for oracle_utils-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 74e8780163b6a033dc0960a85cd32ebeece1a2649a993a5c47563a70999b44c3
MD5 0f0d0eb3b3790b1491a00101146c10c9
BLAKE2b-256 2fb64cdc4396424f8ee7232d79c8f8f779a64a9752abffe9f9967fbb0124f8dc

See more details on using hashes here.

Supported by

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