Skip to content

Commit

Permalink
Generator for CKAN (#89)
Browse files Browse the repository at this point in the history
  • Loading branch information
m-qlas authored Sep 7, 2023
1 parent 9b935a0 commit 01c5cc1
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
2 changes: 2 additions & 0 deletions oddrn_generator/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
GCSGenerator,
AzureBlobStorageGenerator,
BigQueryStorageGenerator,
CKANGenerator,
)

__all__ = [
Expand Down Expand Up @@ -118,4 +119,5 @@
"GCSGenerator",
"AzureBlobStorageGenerator",
"BigQueryStorageGenerator",
"CKANGenerator",
]
7 changes: 7 additions & 0 deletions oddrn_generator/generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
VerticaPathsModel,
BlobPathsModel,
BigQueryStoragePathsModel,
CKANPathsModel,
)
from oddrn_generator.server_models import (
AbstractServerModel,
Expand Down Expand Up @@ -533,3 +534,9 @@ class BigQueryStorageGenerator(Generator):
source = "bigquery_storage"
paths_model = BigQueryStoragePathsModel
server_model = GCPCloudModel


class CKANGenerator(Generator):
source = "ckan"
paths_model = CKANPathsModel
server_model = HostnameModel
17 changes: 17 additions & 0 deletions oddrn_generator/path_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -852,3 +852,20 @@ class Config:
"tables": ("datasets", "tables"),
"columns": ("datasets", "tables", "columns"),
}


class CKANPathsModel(BasePathsModel):
organizations: Optional[str]
groups: Optional[str]
datasets: Optional[str]
resources: Optional[str]
fields: Optional[str]

class Config:
dependencies_map = {
"organizations": ("organizations",),
"groups": ("groups",),
"datasets": ("organizations", "datasets"),
"resources": ("organizations", "datasets", "resources"),
"fields": ("organizations", "datasets", "resources", "fields"),
}

0 comments on commit 01c5cc1

Please sign in to comment.