Skip to main content

Utilities for querying and loading data into an Oracle, Snowflake, or Postgres database.

Project description

wdb_utils

Utilities for querying an Oracle, Snowflake, or Postgres database. Gradually expanding to more database types.

All the methods in this package require a yaml config file. For convenience, we assume this file is located in /Users/username/configs/config-default.yml.

Installation

pip install wdb_utils

Usage

import wdb_utils as db

# Assuming your config file is located at /Users/myname/configs/config-default.yml

# Pull all the data from an Oracle database table into a data frame
df = db.run_query_oracle('select * from my_table')

# Pull all the data from a Snowflake database table into a data frame
df = db.run_query_snowflake('select * from other_table')

# Pull all the data from a Postgres database table into a data frame
df = db.run_query_postgres('select * from third_table')

# Delete all the data in those same tables
db.run_command_oracle('delete from my_table')
db.run_command_snowflake('delete from other_table')
db.run_command_postgres('delete from third_table')

# Put all the data back into the table
# Be aware that record order is not guaranteed to be preserved here
# Trying to decide if that's enough of a problem to fix it
db.load_data_oracle(df, 'my_schema', 'my_table')
db.load_data_snowflake(df, 'another_schema', 'other_table')
db.load_data_postgres(df, 'third_schema', 'third_table')

Backward compatibility

Because this package was initially only for Oracle databases, I've also aliased the following methods to keep working:

  • run_query is an alias for run_query_oracle
  • run_command is an alias for run_command_oracle
  • load_data is an alias for load_data_oracle

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

wdb_utils-3.7.2.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

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

wdb_utils-3.7.2-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file wdb_utils-3.7.2.tar.gz.

File metadata

  • Download URL: wdb_utils-3.7.2.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for wdb_utils-3.7.2.tar.gz
Algorithm Hash digest
SHA256 167da4cf8bfc9d9257b8a22fb2a2f862d9fc49c6d85b2f71ce4ec83b06aedb0d
MD5 adeeeef70d2cbdab820048ae7c023c35
BLAKE2b-256 f8d39c3c702761a66ce1854381835d024046163330815d009a8973759299233a

See more details on using hashes here.

File details

Details for the file wdb_utils-3.7.2-py3-none-any.whl.

File metadata

  • Download URL: wdb_utils-3.7.2-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for wdb_utils-3.7.2-py3-none-any.whl
Algorithm Hash digest
SHA256 155176ad4da1405e36d9a6e349a5e969f88be2102fb5fb0415a61faa79d5c269
MD5 8fcab0a3c6456c3c124961a5ac3af33a
BLAKE2b-256 8923663c8f83306204d3e9de5b5f6bef3b17a5eeac44dc52e36469b323dc3536

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