Skip to content

Commit

Permalink
Schema proposal for Dgraph
Browse files Browse the repository at this point in the history
  • Loading branch information
fridex committed Apr 24, 2019
1 parent 1166a84 commit 0f4fa8e
Show file tree
Hide file tree
Showing 14 changed files with 1,746 additions and 870 deletions.
1 change: 1 addition & 0 deletions Pipfile
Expand Up @@ -10,6 +10,7 @@ thoth-common = "*"
amun = "*"
pydgraph = "*"
python-dateutil = "*"
thoth-python = "*"

[dev-packages]
pytest = "*"
Expand Down
151 changes: 136 additions & 15 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion create_schema.py
Expand Up @@ -51,7 +51,7 @@ def create_schema(models: frozenset):
raise ValueError(f"Unknown entity - not derived from vertex nor edge: {model}")

for attribute in model.__attrs_attrs__:
if attribute.name in ("source", "target", "_uid"):
if attribute.name in ("source", "target", "uid"):
# Edge attributes for storing source and target vertex or uid which is automatically generated.
continue

Expand Down
Binary file modified docs/schema.dia
Binary file not shown.
Binary file modified docs/schema.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions requirements.txt
Expand Up @@ -4,3 +4,4 @@ thoth-common
amun
pydgraph
python-dateutil
thoth-python
5 changes: 5 additions & 0 deletions setup.py
Expand Up @@ -60,6 +60,11 @@ def run_tests(self):
'thoth.storages',
'thoth.storages.graph'
],
package_data={
'thoth.storages': [
os.path.join('graph', 'schema.rdf')
]
},
zip_safe=False,
install_requires=get_install_requires(),
tests_require=get_test_requires(),
Expand Down
2 changes: 1 addition & 1 deletion thoth/storages/dependency_monkey_reports.py
Expand Up @@ -25,7 +25,7 @@ class DependencyMonkeyReportsStore(ResultStorageBase):

RESULT_TYPE = "dependency-monkey-reports"

def iterate_inspection_ids() -> str:
def iterate_inspection_ids(self) -> str:
"""Iterate over all inspection ids that were run."""
for _, report in self.iterate_results():
# Yield inspections.
Expand Down
8 changes: 8 additions & 0 deletions thoth/storages/exceptions.py
Expand Up @@ -36,3 +36,11 @@ class CacheMiss(ThothStorageException):

class NotConnected(ThothStorageException):
"""Raised if there was no connection established when communicating with a storage."""


class MultipleFoundError(ThothStorageException):
"""Raised if there are multiple entities in the graph database when querying for a single one."""


class PythonIndexNotRegistered(ThothStorageException):
"""Raised if an attempt to insert a Python package with an index not being registered to the system."""

0 comments on commit 0f4fa8e

Please sign in to comment.