objectiv-bach


Nameobjectiv-bach JSON
Version 0.0.13 PyPI version JSON
download
home_pagehttps://github.com/objectiv/objectiv-analytics/
SummaryObjectiv Bach provides Pandas-like DataFrames backed by SQL
upload_time2022-06-23 21:17:11
maintainer
docs_urlNone
authorObjectiv B.V.
requires_python>=3.7
licenseApache License 2.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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](https://objectiv.io/docs/taxonomy/).

Bach uses [`sql_models`](./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](./sql_models/README.md) for more information.

Visit [Objectiv Docs](https://objectiv.io/docs/modeling/bach/) to learn more

## Using Bach
To use Bach, use the following command:
```bash
pip install objectiv-bach
```

If you want the latest and greatest from your local checkout, install objectiv_bach in edit mode:
```bash
pip install -e .
```

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](https://www.objectiv.io/docs).


## Running Functional and Unit Tests
In case you are interested on running tests, install all requirements from ``requirements-dev.txt``

### Setting up environmental variables
Functional tests require reading from multiple databases, in order to run them you should define
any of the following variables (based on the engine you want to test):

|    Database     |                  |           Variables          |
|:---------------:|------------------|:----------------------------:|
|    Postgres     | Database URL     |     `OBJ_DB_PG_TEST_URL`     |
|    BigQuery     | Database URL     |     `OBJ_DB_BQ_TEST_URL`     |
|    BigQuery     | Credentials Path | `OBJ_DB_BQ_CREDENTIALS_PATH` |



### Running Postgres-only tests
For running tests for Postgres, run the following command:
```bash
make tests
```

### Running BigQuery-only tests
Before running tests for BigQuery, please make sure you have the following tables in your dataset:

**Cities**
```sql
insert into `<YOUR_PROJECT>.<YOUR_DATASET>.cities`(skating_order, city, municipality, inhabitants, founding)
values
    (1, 'Ljouwert', 'Leeuwarden', 93485, 1285),
    (2, 'Snits', 'Súdwest-Fryslân', 33520, 1456),
    (3, 'Drylts', 'Súdwest-Fryslân', 3055, 1268),
    (4, 'Sleat', 'De Friese Meren', 700, 1426),
    (5, 'Starum', 'Súdwest-Fryslân', 960, 1061),
    (6, 'Hylpen', 'Súdwest-Fryslân', 870, 1225),
    (7, 'Warkum', 'Súdwest-Fryslân', 4440, 1399),
    (8, 'Boalsert', 'Súdwest-Fryslân', 10120, 1455),
    (9, 'Harns', 'Harlingen', 14740, 1234),
    (10, 'Frjentsjer', 'Waadhoeke', 12760, 1374),
    (11, 'Dokkum', 'Noardeast-Fryslân', 12675, 1298);
```
**Foods**
```sql
insert into `<YOUR_PROJECT>.<YOUR_DATASET>.foods`(skating_order, food, moment, date)
values
    (1, 'Sûkerbôlle', '2021-05-03 11:28:36.388', '2021-05-03'),
    (2, 'Dúmkes', '2021-05-04 23:28:36.388', '2021-05-04'),
    (4, 'Grutte Pier Bier', '2022-05-03 14:13:13.388', '2022-05-03');
```
**Railways**
```sql
insert into `<YOUR_PROJECT>.<YOUR_DATASET>.railways`(station_id, town, station, platforms)
values
    (1, 'Drylts', 'IJlst', 1),
    (2, 'It Hearrenfean', 'Heerenveen', 1),
    (3, 'It Hearrenfean', 'Heerenveen IJsstadion', 2),
    (4, 'Ljouwert', 'Leeuwarden', 4),
    (5, 'Ljouwert', 'Camminghaburen', 1),
    (6, 'Snits', 'Sneek', 2),
    (7, 'Snits', 'Sneek Noord', 2);
```

After setting up your tables, run the following command:
```bash
make tests-bigquery
```

### Running tests for all databases
In case you want to run all tests for multiple database, run the following command:
```bash
make tests-all
```

## See Also
* [Pandas](https://github.com/pandas-dev/pandas): the inspiration for the API.
   Pandas has excellent [documentation](https://pandas.pydata.org/docs/) for its API.
* [SQL-models](./sql_models/): Sub-project that is used for generating the underlying sql-queries. Can be 
  found in the [`sql_models`](./sql_models/) package

## Support & Troubleshooting
If you need help using or installing Bach, join our [Slack channel](https://objectiv.io/join-slack/) 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](https://objectiv.io/docs/home/the-project/contribute/).

## Security Disclosure
Found a security issue? Please don’t use the issue tracker but contact us directly. See [SECURITY.md](../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](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](../LICENSE.md) for details.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/objectiv/objectiv-analytics/",
    "name": "objectiv-bach",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "",
    "author": "Objectiv B.V.",
    "author_email": "hi@objectiv.io",
    "download_url": "https://files.pythonhosted.org/packages/51/9e/bc75715570a89b20fc29ba5ab0c53548166601bf2eca5a6966ff8fe45592/objectiv-bach-0.0.13.tar.gz",
    "platform": null,
    "description": "# Objectiv Bach: Pandas-like DataFrames backed by SQL\n\nBach 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](https://objectiv.io/docs/taxonomy/).\n\nBach uses [`sql_models`](./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](./sql_models/README.md) for more information.\n\nVisit [Objectiv Docs](https://objectiv.io/docs/modeling/bach/) to learn more\n\n## Using Bach\nTo use Bach, use the following command:\n```bash\npip install objectiv-bach\n```\n\nIf you want the latest and greatest from your local checkout, install objectiv_bach in edit mode:\n```bash\npip install -e .\n```\n\nThis will install Bach in edit mode, meaning you get the latest version from the local checkout.\nFor detailed installation & usage instructions, visit [Objectiv Docs](https://www.objectiv.io/docs).\n\n\n## Running Functional and Unit Tests\nIn case you are interested on running tests, install all requirements from ``requirements-dev.txt``\n\n### Setting up environmental variables\nFunctional tests require reading from multiple databases, in order to run them you should define\nany of the following variables (based on the engine you want to test):\n\n|    Database     |                  |           Variables          |\n|:---------------:|------------------|:----------------------------:|\n|    Postgres     | Database URL     |     `OBJ_DB_PG_TEST_URL`     |\n|    BigQuery     | Database URL     |     `OBJ_DB_BQ_TEST_URL`     |\n|    BigQuery     | Credentials Path | `OBJ_DB_BQ_CREDENTIALS_PATH` |\n\n\n\n### Running Postgres-only tests\nFor running tests for Postgres, run the following command:\n```bash\nmake tests\n```\n\n### Running BigQuery-only tests\nBefore running tests for BigQuery, please make sure you have the following tables in your dataset:\n\n**Cities**\n```sql\ninsert into `<YOUR_PROJECT>.<YOUR_DATASET>.cities`(skating_order, city, municipality, inhabitants, founding)\nvalues\n    (1, 'Ljouwert', 'Leeuwarden', 93485, 1285),\n    (2, 'Snits', 'S\u00fadwest-Frysl\u00e2n', 33520, 1456),\n    (3, 'Drylts', 'S\u00fadwest-Frysl\u00e2n', 3055, 1268),\n    (4, 'Sleat', 'De Friese Meren', 700, 1426),\n    (5, 'Starum', 'S\u00fadwest-Frysl\u00e2n', 960, 1061),\n    (6, 'Hylpen', 'S\u00fadwest-Frysl\u00e2n', 870, 1225),\n    (7, 'Warkum', 'S\u00fadwest-Frysl\u00e2n', 4440, 1399),\n    (8, 'Boalsert', 'S\u00fadwest-Frysl\u00e2n', 10120, 1455),\n    (9, 'Harns', 'Harlingen', 14740, 1234),\n    (10, 'Frjentsjer', 'Waadhoeke', 12760, 1374),\n    (11, 'Dokkum', 'Noardeast-Frysl\u00e2n', 12675, 1298);\n```\n**Foods**\n```sql\ninsert into `<YOUR_PROJECT>.<YOUR_DATASET>.foods`(skating_order, food, moment, date)\nvalues\n    (1, 'S\u00fbkerb\u00f4lle', '2021-05-03 11:28:36.388', '2021-05-03'),\n    (2, 'D\u00famkes', '2021-05-04 23:28:36.388', '2021-05-04'),\n    (4, 'Grutte Pier Bier', '2022-05-03 14:13:13.388', '2022-05-03');\n```\n**Railways**\n```sql\ninsert into `<YOUR_PROJECT>.<YOUR_DATASET>.railways`(station_id, town, station, platforms)\nvalues\n    (1, 'Drylts', 'IJlst', 1),\n    (2, 'It Hearrenfean', 'Heerenveen', 1),\n    (3, 'It Hearrenfean', 'Heerenveen IJsstadion', 2),\n    (4, 'Ljouwert', 'Leeuwarden', 4),\n    (5, 'Ljouwert', 'Camminghaburen', 1),\n    (6, 'Snits', 'Sneek', 2),\n    (7, 'Snits', 'Sneek Noord', 2);\n```\n\nAfter setting up your tables, run the following command:\n```bash\nmake tests-bigquery\n```\n\n### Running tests for all databases\nIn case you want to run all tests for multiple database, run the following command:\n```bash\nmake tests-all\n```\n\n## See Also\n* [Pandas](https://github.com/pandas-dev/pandas): the inspiration for the API.\n   Pandas has excellent [documentation](https://pandas.pydata.org/docs/) for its API.\n* [SQL-models](./sql_models/): Sub-project that is used for generating the underlying sql-queries. Can be \n  found in the [`sql_models`](./sql_models/) package\n\n## Support & Troubleshooting\nIf you need help using or installing Bach, join our [Slack channel](https://objectiv.io/join-slack/) and post your question there. \n\n## Bug Reports & Feature Requests\nIf you\u2019ve found an issue or have a feature request, please check out the [Contribution Guide](https://objectiv.io/docs/home/the-project/contribute/).\n\n## Security Disclosure\nFound a security issue? Please don\u2019t use the issue tracker but contact us directly. See [SECURITY.md](../SECURITY.md) for details.\n\n## Custom development & contributing code\nIf you want to contribute to Objectiv or use it as a base for custom development, take a look at [CONTRIBUTING.md](CONTRIBUTING.md). It contains detailed development instructions and a link to information about our contribution process and where you can fit in.\n\n## License\nThis repository is part of the source code for Objectiv, which is released under the Apache 2.0 License. Please refer to [LICENSE.md](../LICENSE.md) for details.\n",
    "bugtrack_url": null,
    "license": "Apache License 2.0",
    "summary": "Objectiv Bach provides Pandas-like DataFrames backed by SQL",
    "version": "0.0.13",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "8097785df1d589c9a22fabe1017c1554",
                "sha256": "afcb72ec41e7e06c70d2c7a780abc5412ce3ef1899087c39e0d48ab18af79a82"
            },
            "downloads": -1,
            "filename": "objectiv_bach-0.0.13-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8097785df1d589c9a22fabe1017c1554",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 178499,
            "upload_time": "2022-06-23T21:17:04",
            "upload_time_iso_8601": "2022-06-23T21:17:04.898461Z",
            "url": "https://files.pythonhosted.org/packages/a8/ae/f30aa5078c6a51cc530cc01d7d95905f71799f0752574570833fd26d5703/objectiv_bach-0.0.13-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "32d3fbaf6d43ab7524a36f3b609c1022",
                "sha256": "88f4d1064ff6c12e6b458dc7171a5aadc764d778182052cdbb55980f9dae54a1"
            },
            "downloads": -1,
            "filename": "objectiv-bach-0.0.13.tar.gz",
            "has_sig": false,
            "md5_digest": "32d3fbaf6d43ab7524a36f3b609c1022",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 158329,
            "upload_time": "2022-06-23T21:17:11",
            "upload_time_iso_8601": "2022-06-23T21:17:11.350117Z",
            "url": "https://files.pythonhosted.org/packages/51/9e/bc75715570a89b20fc29ba5ab0c53548166601bf2eca5a6966ff8fe45592/objectiv-bach-0.0.13.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-06-23 21:17:11",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "objectiv",
    "github_project": "objectiv-analytics",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "objectiv-bach"
}
        
Elapsed time: 0.82759s