dbrepo


Namedbrepo JSON
Version 1.10.1 PyPI version JSON
download
home_pagehttps://www.ifs.tuwien.ac.at/infrastructures/dbrepo/1.10/
SummaryDBRepo Python Library
upload_time2025-07-11 08:43:22
maintainerNone
docs_urlNone
authorMartin Weise
requires_python>=3.11
licenseNone
keywords dbrepo database repository
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # DBRepo Python Library

Official client library for [DBRepo](https://www.ifs.tuwien.ac.at/infrastructures/dbrepo/1.4.3/), a database
repository to support research based
on [requests](https://pypi.org/project/requests/), [pydantic](https://pypi.org/project/pydantic/) 
and [pika](https://pypi.org/project/pika/).

## Installing

```console
$ python -m pip install dbrepo
```

This package supports Python 3.11+.

## Quickstart

Get public data from a table as pandas `DataFrame`:

```python
from dbrepo.RestClient import RestClient

client = RestClient(endpoint="https://test.dbrepo.tuwien.ac.at")
# Get a small data slice of just three rows
df = client.get_table_data(database_id="e0d82287-9099-4077-8f69-3c19fc3bc145",
                           table_id="71f8c746-ea26-4651-b3f2-ce46830f1af4",
                           page=0, size=3)
print(df)
#     x_coord         component   unit  ... value stationid meantype
# 0  16.52617  Feinstaub (PM10)  µg/m³  ...  21.0   01:0001      HMW
# 1  16.52617  Feinstaub (PM10)  µg/m³  ...  23.0   01:0001      HMW
# 2  16.52617  Feinstaub (PM10)  µg/m³  ...  26.0   01:0001      HMW
#
# [3 rows x 12 columns]
```

Create table and import `DataFrame` into a table:

```python
import pandas as pd
from dbrepo.RestClient import RestClient

client = RestClient(endpoint="https://test.dbrepo.tuwien.ac.at", username="foo",
                    password="bar")
df = pd.DataFrame(data={'x_coord': 16.52617, 'component': 'Feinstaub (PM10)',
                        'unit': 'µg/m³', ...})
df = df.set_index(['x_coord'])
client.create_table(database_id="e0d82287-9099-4077-8f69-3c19fc3bc145",
                    name="Sensor", is_public=True, is_schema_public=True,
                    dataframe=df)
```

... or just create the table schema by setting `create_table(..., withData=False)`.

In both cases it is important to set the index to existing columns that uniquely
identify a row. You can specify multiple columns:

```python
...
df = df.set_index(['some_column', 'some_other_column'])
```

## Supported Features & Best-Practices

- Manage user
  account ([docs](https://www.ifs.tuwien.ac.at/infrastructures/dbrepo/1.6/api/#create-user-account))
- Manage
  databases ([docs](https://www.ifs.tuwien.ac.at/infrastructures/dbrepo/1.6/usage-overview/#create-database))
- Manage database access &
  visibility ([docs](https://www.ifs.tuwien.ac.at/infrastructures/dbrepo/1.6/api/#create-database))
- Import
  dataset ([docs](https://www.ifs.tuwien.ac.at/infrastructures/dbrepo/1.6/api/#import-dataset))
- Create persistent
  identifiers ([docs](https://www.ifs.tuwien.ac.at/infrastructures/dbrepo/1.6/api/#assign-database-pid))
- Execute
  queries ([docs](https://www.ifs.tuwien.ac.at/infrastructures/dbrepo/1.6/api/#export-subset))
- Get data from tables/views/subsets

## Configure

All credentials can optionally be set/overridden with environment variables. This is especially useful when sharing 
Jupyter Notebooks by creating an invisible `.env` file and loading it:

```
REST_API_ENDPOINT="https://dbrepo1.ec.tuwien.ac.at"
REST_API_USERNAME="foo"
REST_API_PASSWORD="bar"
REST_API_SECURE="True"
AMQP_API_HOST="https://dbrepo1.ec.tuwien.ac.at"
AMQP_API_PORT="5672"
AMQP_API_USERNAME="foo"
AMQP_API_PASSWORD="bar"
AMQP_API_VIRTUAL_HOST="dbrepo"
```

You can disable logging by setting the log level to e.g. `INFO`:

```python
from dbrepo.RestClient import RestClient
import logging
logging.getLogger().setLevel(logging.INFO)
...
client = RestClient(...)
```

## Roadmap

- Searching

## Contact

* Prof. [Andreas Rauber](https://tiss.tuwien.ac.at/person/39608.html)<sup>TU Wien</sup>
* DI. [Martin Weise](https://tiss.tuwien.ac.at/person/287722.html)<sup>TU Wien</sup>

            

Raw data

            {
    "_id": null,
    "home_page": "https://www.ifs.tuwien.ac.at/infrastructures/dbrepo/1.10/",
    "name": "dbrepo",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.11",
    "maintainer_email": null,
    "keywords": "DBRepo, Database Repository",
    "author": "Martin Weise",
    "author_email": "\"Martin Weise, TU Wien\" <martin.weise@tuwien.ac.at>",
    "download_url": "https://files.pythonhosted.org/packages/80/e0/767664336cd5d9e44c5106bc4f3a4b0759a962df1c896f28867bc840345b/dbrepo-1.10.1.tar.gz",
    "platform": null,
    "description": "# DBRepo Python Library\n\nOfficial client library for [DBRepo](https://www.ifs.tuwien.ac.at/infrastructures/dbrepo/1.4.3/), a database\nrepository to support research based\non [requests](https://pypi.org/project/requests/), [pydantic](https://pypi.org/project/pydantic/) \nand [pika](https://pypi.org/project/pika/).\n\n## Installing\n\n```console\n$ python -m pip install dbrepo\n```\n\nThis package supports Python 3.11+.\n\n## Quickstart\n\nGet public data from a table as pandas `DataFrame`:\n\n```python\nfrom dbrepo.RestClient import RestClient\n\nclient = RestClient(endpoint=\"https://test.dbrepo.tuwien.ac.at\")\n# Get a small data slice of just three rows\ndf = client.get_table_data(database_id=\"e0d82287-9099-4077-8f69-3c19fc3bc145\",\n                           table_id=\"71f8c746-ea26-4651-b3f2-ce46830f1af4\",\n                           page=0, size=3)\nprint(df)\n#     x_coord         component   unit  ... value stationid meantype\n# 0  16.52617  Feinstaub (PM10)  \u00b5g/m\u00b3  ...  21.0   01:0001      HMW\n# 1  16.52617  Feinstaub (PM10)  \u00b5g/m\u00b3  ...  23.0   01:0001      HMW\n# 2  16.52617  Feinstaub (PM10)  \u00b5g/m\u00b3  ...  26.0   01:0001      HMW\n#\n# [3 rows x 12 columns]\n```\n\nCreate table and import `DataFrame` into a table:\n\n```python\nimport pandas as pd\nfrom dbrepo.RestClient import RestClient\n\nclient = RestClient(endpoint=\"https://test.dbrepo.tuwien.ac.at\", username=\"foo\",\n                    password=\"bar\")\ndf = pd.DataFrame(data={'x_coord': 16.52617, 'component': 'Feinstaub (PM10)',\n                        'unit': '\u00b5g/m\u00b3', ...})\ndf = df.set_index(['x_coord'])\nclient.create_table(database_id=\"e0d82287-9099-4077-8f69-3c19fc3bc145\",\n                    name=\"Sensor\", is_public=True, is_schema_public=True,\n                    dataframe=df)\n```\n\n... or just create the table schema by setting `create_table(..., withData=False)`.\n\nIn both cases it is important to set the index to existing columns that uniquely\nidentify a row. You can specify multiple columns:\n\n```python\n...\ndf = df.set_index(['some_column', 'some_other_column'])\n```\n\n## Supported Features & Best-Practices\n\n- Manage user\n  account ([docs](https://www.ifs.tuwien.ac.at/infrastructures/dbrepo/1.6/api/#create-user-account))\n- Manage\n  databases ([docs](https://www.ifs.tuwien.ac.at/infrastructures/dbrepo/1.6/usage-overview/#create-database))\n- Manage database access &\n  visibility ([docs](https://www.ifs.tuwien.ac.at/infrastructures/dbrepo/1.6/api/#create-database))\n- Import\n  dataset ([docs](https://www.ifs.tuwien.ac.at/infrastructures/dbrepo/1.6/api/#import-dataset))\n- Create persistent\n  identifiers ([docs](https://www.ifs.tuwien.ac.at/infrastructures/dbrepo/1.6/api/#assign-database-pid))\n- Execute\n  queries ([docs](https://www.ifs.tuwien.ac.at/infrastructures/dbrepo/1.6/api/#export-subset))\n- Get data from tables/views/subsets\n\n## Configure\n\nAll credentials can optionally be set/overridden with environment variables. This is especially useful when sharing \nJupyter Notebooks by creating an invisible `.env` file and loading it:\n\n```\nREST_API_ENDPOINT=\"https://dbrepo1.ec.tuwien.ac.at\"\nREST_API_USERNAME=\"foo\"\nREST_API_PASSWORD=\"bar\"\nREST_API_SECURE=\"True\"\nAMQP_API_HOST=\"https://dbrepo1.ec.tuwien.ac.at\"\nAMQP_API_PORT=\"5672\"\nAMQP_API_USERNAME=\"foo\"\nAMQP_API_PASSWORD=\"bar\"\nAMQP_API_VIRTUAL_HOST=\"dbrepo\"\n```\n\nYou can disable logging by setting the log level to e.g. `INFO`:\n\n```python\nfrom dbrepo.RestClient import RestClient\nimport logging\nlogging.getLogger().setLevel(logging.INFO)\n...\nclient = RestClient(...)\n```\n\n## Roadmap\n\n- Searching\n\n## Contact\n\n* Prof. [Andreas Rauber](https://tiss.tuwien.ac.at/person/39608.html)<sup>TU Wien</sup>\n* DI. [Martin Weise](https://tiss.tuwien.ac.at/person/287722.html)<sup>TU Wien</sup>\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "DBRepo Python Library",
    "version": "1.10.1",
    "project_urls": {
        "Documentation": "https://www.ifs.tuwien.ac.at/infrastructures/dbrepo/1.9/python/",
        "Homepage": "https://www.ifs.tuwien.ac.at/infrastructures/dbrepo/1.9/",
        "Issues": "https://gitlab.phaidra.org/fair-data-austria-db-repository/fda-services/-/issues",
        "Source": "https://gitlab.phaidra.org/fair-data-austria-db-repository/fda-services/"
    },
    "split_keywords": [
        "dbrepo",
        " database repository"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "dd4e4458c9f9b046d6219889a831549559524785912204472cc1abc262c5e47e",
                "md5": "4a3d09b91ae27b9c123aeefb7093fd13",
                "sha256": "5b09ff039744a1263eea28062eab92f35c4b19826dd6fac80cafb244b9c14a0b"
            },
            "downloads": -1,
            "filename": "dbrepo-1.10.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "4a3d09b91ae27b9c123aeefb7093fd13",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11",
            "size": 83782,
            "upload_time": "2025-07-11T08:43:20",
            "upload_time_iso_8601": "2025-07-11T08:43:20.833796Z",
            "url": "https://files.pythonhosted.org/packages/dd/4e/4458c9f9b046d6219889a831549559524785912204472cc1abc262c5e47e/dbrepo-1.10.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "80e0767664336cd5d9e44c5106bc4f3a4b0759a962df1c896f28867bc840345b",
                "md5": "c46348bf1ed0af6d3dadb420e50f4e1b",
                "sha256": "86c8dcfd713df9de27156fec26a6c07c2af6dcc3632a4b978ba6f9f894886581"
            },
            "downloads": -1,
            "filename": "dbrepo-1.10.1.tar.gz",
            "has_sig": false,
            "md5_digest": "c46348bf1ed0af6d3dadb420e50f4e1b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 98082,
            "upload_time": "2025-07-11T08:43:22",
            "upload_time_iso_8601": "2025-07-11T08:43:22.378585Z",
            "url": "https://files.pythonhosted.org/packages/80/e0/767664336cd5d9e44c5106bc4f3a4b0759a962df1c896f28867bc840345b/dbrepo-1.10.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-11 08:43:22",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "dbrepo"
}
        
Elapsed time: 0.86442s