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

Uploaded Python 3

File details

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

File metadata

  • Download URL: wdb_utils-3.7.3.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.3.tar.gz
Algorithm Hash digest
SHA256 70f087b2dc6950e1e8de877bf0c3a0945ed10072f757fb90cc81b84598d7ad52
MD5 74f2a251c0533104f63bc27b906d0f1c
BLAKE2b-256 0b98dfd09ed06541f53542bf01cef9f10fe3f21cce32f50dc2a881650b07d934

See more details on using hashes here.

File details

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

File metadata

  • Download URL: wdb_utils-3.7.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 0116c7980a191805e3556aa630c19f0504e1a6414fb462645ab81871e76db630
MD5 fdedc4b899a02f390fee701cb150da80
BLAKE2b-256 bc9049dc238ce871d78d59646830ee335a93c7d04ed15c1bc41893ccec6ce66d

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