Skip to main content

Objectiv Bach provides Pandas-like DataFrames backed by SQL

Project description

Objectiv Bach: Pandas-like DataFrames backed by SQL

Bach is a python-based data modeling library that enables you to use Pandas-like operations that run on your full dataset in the SQL database. Any dataframe or model built with Bach can be converted to an SQL statement with a single command. It includes a set of operations that enable effective feature creation for data sets that embrace the open analytics taxonomy.

Bach uses sql_models under the hood, which makes it possible to easily build graphs of SQL models and generate SQL for the resulting composite sql-models. See sql_models/README.md for more information.

Visit Objectiv Docs to learn more

Using Bach

To use Bach, use the following command:

pip install objectiv-bach
pip install objectiv-bach[bigquery] # for bigquery support

If you want the latest and greatest from your local checkout, install objectiv_bach in edit mode:

pip install -e .
pip install -e .[bigquery] # for bigquery support

This will install Bach in edit mode, meaning you get the latest version from the local checkout. For detailed installation & usage instructions, visit Objectiv Docs.

Running Functional and Unit Tests

In case you are interested on running tests, install all dev requirements through:

pip install -e .[dev,bigquery]

Setting up environmental variables

Functional tests require access to multiple databases. In order to run them you should define the variables shown in the below table, depending on the engine you want to test. Variables can be set as environment variables, or can be defined in the file .secrets/.test_env.

Database Variables Description
Postgres OBJ_DB_PG_TEST_URL Database URL
Athena OBJ_DB_ATHENA_TEST_URL Database URL
Athena OBJ_DB_ATHENA_AWS_ACCESS_KEY_ID Access key id*
Athena OBJ_DB_ATHENA_AWS_SECRET_ACCESS_KEY Secret key*
Athena OBJ_DB_ATHENA_REGION_NAME Region*
Athena OBJ_DB_ATHENA_SCHEMA_NAME Schema name*
Athena OBJ_DB_ATHENA_S3_STAGING_DIR S3 staging dir*
Athena OBJ_DB_ATHENA_WORK_GROUP Workgroup to run queries as*
BigQuery OBJ_DB_BQ_TEST_URL Database URL
BigQuery OBJ_DB_BQ_CREDENTIALS_PATH Credentials Path

For Athena one can either specify the full connection string as OBJ_DB_ATHENA_TEST_URL or set all the fields marked with an asterisk. The asterisk marked fields are ignored if OBJ_DB_ATHENA_TEST_URL is set.

For more information on creating the correct database setup, see the markdown files in the tests/ folder.

Running Tests for different databases

For running tests for Postgres, as well as database independent tests, run the following command:

make tests

For running tests for Athena, as well as database independent tests, run the following command:

make tests-athena

For running tests for BigQuery, as well as database independent tests, run the following command:

make tests-bigquery

In case you want to run all tests for all supported databases, as well as database independent tests, run the following command:

make tests-all

See Also

  • Pandas: the inspiration for the API. Pandas has excellent documentation for its API.
  • SQL-models: Sub-project that is used for generating the underlying sql-queries. Can be found in the sql_models package

Support & Troubleshooting

If you need help using or installing Bach, join our Slack channel and post your question there.

Bug Reports & Feature Requests

If you’ve found an issue or have a feature request, please check out the Contribution Guide.

Security Disclosure

Found a security issue? Please don’t use the issue tracker but contact us directly. See SECURITY.md for details.

Custom development & contributing code

If you want to contribute to Objectiv or use it as a base for custom development, take a look at CONTRIBUTING.md. It contains detailed development instructions and a link to information about our contribution process and where you can fit in.

License

This repository is part of the source code for Objectiv, which is released under the Apache 2.0 License. Please refer to LICENSE.md for details.

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

objectiv-bach-0.0.24.tar.gz (178.0 kB view details)

Uploaded Source

Built Distribution

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

objectiv_bach-0.0.24-py3-none-any.whl (201.7 kB view details)

Uploaded Python 3

File details

Details for the file objectiv-bach-0.0.24.tar.gz.

File metadata

  • Download URL: objectiv-bach-0.0.24.tar.gz
  • Upload date:
  • Size: 178.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.10

File hashes

Hashes for objectiv-bach-0.0.24.tar.gz
Algorithm Hash digest
SHA256 0fb4e4c80331be64a3db01966f6f2f494b3db3b592332ab4b333ab1d78994380
MD5 0265c04ef48b8bd725e3f879892c7427
BLAKE2b-256 c21f7176a3112ec7d34e98f72ac59e0df0355637c2ff04966ff2c89953994e05

See more details on using hashes here.

File details

Details for the file objectiv_bach-0.0.24-py3-none-any.whl.

File metadata

  • Download URL: objectiv_bach-0.0.24-py3-none-any.whl
  • Upload date:
  • Size: 201.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.10

File hashes

Hashes for objectiv_bach-0.0.24-py3-none-any.whl
Algorithm Hash digest
SHA256 7d05322fecd1a0e0cc6380447b9179a99abf51a51eb46e93cec318dd196fa85f
MD5 aad5148ebead431c888b1dc5c26ed595
BLAKE2b-256 3e1622e93b406633ee108c1203890eb31c258b8f9946b03c00afda734dfe7f9d

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