Metadata-Version: 2.1
Name: odd-models
Version: 1.0.22
Summary: Open Data Discovery Models
Home-page: https://github.com/opendatadiscovery/odd-models-packager
License: Apache-2.0
Keywords: odd-models,odd_models,opendatadiscovery
Author: Open Data Discovery
Author-email: pypi@opendatadiscovery.org
Requires-Python: >=3.6.1,<4.0.0
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Requires-Dist: Flask-Compress (==1.10.1)
Requires-Dist: connexion (==2.13.1)
Requires-Dist: pydantic (==1.8.2)
Requires-Dist: sqlparse (==0.4.2)
Project-URL: Repository, https://github.com/opendatadiscovery/odd-models-package
Description-Content-Type: text/markdown

# Open Data Discovery Models Package

## Models
You can use odd pydantic models:
```python
from odd_models.models import DataEntityList

data_entity_list = DataEntityList(data_source_oddrn='/postgresql/host/localhost/databases/opendatadiscovery', items=[])
```

## Adapter's Controller
You can inherit from base Adapter Controller for writing your own adapters:
```python
from odd_models.adapter.controllers import ODDController

class MyController(ODDController):
    def get_data_entities(self, changed_since=None, )
        pass
```

## ODD API Client
You can use ready API Client to send requests:
```python
from odd_models.api_client import ODDApiClient

api_client = ODDApiClient(base_url='http://127.0.0.1:8080')

# using pydantic objects:
from odd_models.models import DataEntityList
data_entity_list = DataEntityList(data_source_oddrn='/postgresql/host/localhost/databases/opendatadiscovery', items=[])

response = api_client.post_data_entity_list(data_entity_list)
assert response.status_code == 200

# using dict (validation will be in the client)
data_entity_list = {'data_source_oddrn': '/postgresql/host/localhost/databases/opendatadiscovery', 'items': []}

response = api_client.post_data_entity_list(data_entity_list)
assert response.status_code == 200
```
