datamodelutils


Namedatamodelutils JSON
Version 1.1.0 PyPI version JSON
download
home_pagehttps://github.com/uc-cdis/datamodelutils
SummaryGen3 Data Model Utils
upload_time2024-10-02 20:55:36
maintainerNone
docs_urlNone
authorCTDS UChicago
requires_python<4,>=3.9
licenseApache-2.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # datamodelutils
[![Docker Repository on Quay](https://quay.io/repository/cdis/datamodelutils/status "Docker Repository on Quay")](https://quay.io/repository/cdis/datamodelutils)

Wrapper utils to allow gen3datamodel.models to be loaded after initialization.

For example

```
from datamodelutils import models
from dictionaryutils import DataDictionary, dictionary

d = DataDictionary(url="https://s3.amazonaws.com/dictionary-artifacts/bhcdictionary/feat/s3/schema.json")

dictionary.init(d)
# Always import gen3datamodel after dictionary has been initialized.
# Creates a singleton for life of python session.
# Required for backward compatibility. 
from gen3datamodel import models as md
models.init(md)

print(models)
```

will produce output of

```
<module 'gen3datamodel.models' from '/Users/phillis/Documents/work/datamodelutils/venv/lib/python3.9/site-packages/gen3datamodel/gen3datamodel/models/__init__.py'>
```

# CLI Utilities
The datamodelutils has a [docker](https://quay.io/repository/cdis/datamodelutils) image that exposes admin commands to manage or interact with datamodel

## datamodel_postgres_admin
Script to do database creation and migration
```
# setup all tables, this should be run when you initialize the database
> export PG_HOST=localhost
> export PG_USER=test
> export PG_PASS=test
> export PG_NAME=test_graph
> export DICTIONARY_URL="https://s3.amazonaws.com/dictionary-artifacts/<dictionary_repl>/<branch>/schema.json"
> datamodel_postgres_admin create-all

# setup/create new graph tables, this should be run for dictionary migrations that needs to setup new tables
datamodel_postgres_admin graph-create
```
## datamodel_repl
repl to interact with datamodel
```
> export PG_HOST=localhost
> export PG_USER=test
> export PG_PASS=test
> export PG_NAME=test_graph
> export DICTIONARY_URL="https://s3.amazonaws.com/dictionary-artifacts/<dictionary_repl>/<branch>/schema.json"
> datamodel_repl
Python 2.7.10 (default, Feb  7 2017, 00:08:15)
Type "copyright", "credits" or "license" for more information.

IPython 5.4.1 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: g.nodes(md.Project).first()
Out[1]: <Project(a77f549b-c74b-563e-80bb-570b5a4dde88)>
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/uc-cdis/datamodelutils",
    "name": "datamodelutils",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4,>=3.9",
    "maintainer_email": null,
    "keywords": null,
    "author": "CTDS UChicago",
    "author_email": "cdis@uchicago.edu",
    "download_url": "https://files.pythonhosted.org/packages/96/be/291841c4652d5bbf50990283d9d4c1c8449013941486cb43aba5f5dbe7c8/datamodelutils-1.1.0.tar.gz",
    "platform": null,
    "description": "# datamodelutils\n[![Docker Repository on Quay](https://quay.io/repository/cdis/datamodelutils/status \"Docker Repository on Quay\")](https://quay.io/repository/cdis/datamodelutils)\n\nWrapper utils to allow gen3datamodel.models to be loaded after initialization.\n\nFor example\n\n```\nfrom datamodelutils import models\nfrom dictionaryutils import DataDictionary, dictionary\n\nd = DataDictionary(url=\"https://s3.amazonaws.com/dictionary-artifacts/bhcdictionary/feat/s3/schema.json\")\n\ndictionary.init(d)\n# Always import gen3datamodel after dictionary has been initialized.\n# Creates a singleton for life of python session.\n# Required for backward compatibility. \nfrom gen3datamodel import models as md\nmodels.init(md)\n\nprint(models)\n```\n\nwill produce output of\n\n```\n<module 'gen3datamodel.models' from '/Users/phillis/Documents/work/datamodelutils/venv/lib/python3.9/site-packages/gen3datamodel/gen3datamodel/models/__init__.py'>\n```\n\n# CLI Utilities\nThe datamodelutils has a [docker](https://quay.io/repository/cdis/datamodelutils) image that exposes admin commands to manage or interact with datamodel\n\n## datamodel_postgres_admin\nScript to do database creation and migration\n```\n# setup all tables, this should be run when you initialize the database\n> export PG_HOST=localhost\n> export PG_USER=test\n> export PG_PASS=test\n> export PG_NAME=test_graph\n> export DICTIONARY_URL=\"https://s3.amazonaws.com/dictionary-artifacts/<dictionary_repl>/<branch>/schema.json\"\n> datamodel_postgres_admin create-all\n\n# setup/create new graph tables, this should be run for dictionary migrations that needs to setup new tables\ndatamodel_postgres_admin graph-create\n```\n## datamodel_repl\nrepl to interact with datamodel\n```\n> export PG_HOST=localhost\n> export PG_USER=test\n> export PG_PASS=test\n> export PG_NAME=test_graph\n> export DICTIONARY_URL=\"https://s3.amazonaws.com/dictionary-artifacts/<dictionary_repl>/<branch>/schema.json\"\n> datamodel_repl\nPython 2.7.10 (default, Feb  7 2017, 00:08:15)\nType \"copyright\", \"credits\" or \"license\" for more information.\n\nIPython 5.4.1 -- An enhanced Interactive Python.\n?         -> Introduction and overview of IPython's features.\n%quickref -> Quick reference.\nhelp      -> Python's own help system.\nobject?   -> Details about 'object', use 'object??' for extra details.\n\nIn [1]: g.nodes(md.Project).first()\nOut[1]: <Project(a77f549b-c74b-563e-80bb-570b5a4dde88)>\n```\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "Gen3 Data Model Utils",
    "version": "1.1.0",
    "project_urls": {
        "Homepage": "https://github.com/uc-cdis/datamodelutils",
        "Repository": "https://github.com/uc-cdis/datamodelutils"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1ba9c3309c5eccb9c8e351eb69046d7c618d0586c482dc996cb4f800fab9dd39",
                "md5": "8956afee05e6cd18214b657eb3201f65",
                "sha256": "4d17958773f6dc299e2ddaa3b56b3c86a0c4c52e1694da60ce1e97dc83b299fc"
            },
            "downloads": -1,
            "filename": "datamodelutils-1.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8956afee05e6cd18214b657eb3201f65",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4,>=3.9",
            "size": 12874,
            "upload_time": "2024-10-02T20:55:35",
            "upload_time_iso_8601": "2024-10-02T20:55:35.068158Z",
            "url": "https://files.pythonhosted.org/packages/1b/a9/c3309c5eccb9c8e351eb69046d7c618d0586c482dc996cb4f800fab9dd39/datamodelutils-1.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "96be291841c4652d5bbf50990283d9d4c1c8449013941486cb43aba5f5dbe7c8",
                "md5": "8c70a008881430064554933724702e8c",
                "sha256": "81f1c0b9ce69c94420e5af12f07f36a1b15bc3ff8e02abde72e804b3e9988f2e"
            },
            "downloads": -1,
            "filename": "datamodelutils-1.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "8c70a008881430064554933724702e8c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4,>=3.9",
            "size": 11345,
            "upload_time": "2024-10-02T20:55:36",
            "upload_time_iso_8601": "2024-10-02T20:55:36.014976Z",
            "url": "https://files.pythonhosted.org/packages/96/be/291841c4652d5bbf50990283d9d4c1c8449013941486cb43aba5f5dbe7c8/datamodelutils-1.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-02 20:55:36",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "uc-cdis",
    "github_project": "datamodelutils",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "datamodelutils"
}
        
Elapsed time: 0.30295s