Details
create_details(resource_id, version, columns, file_hash=None)
¶
Helper for creating a DatastoreResourceDetails object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
resource_id
|
str
|
the resource id of the ingested resource |
required |
version
|
int
|
the version being ingested |
required |
columns
|
List[str]
|
the columns present in the ingested resource |
required |
file_hash
|
Optional[str]
|
the computed file hash of the uploaded data |
None
|
Returns:
| Type | Description |
|---|---|
int
|
the id of the created row |
Source code in ckanext/versioned_datastore/lib/importing/details.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | |
get_all_details(resource_id, up_to_version=None)
¶
Retrieve all the details for a resource and return them as an OrderedDict using the versions as the keys. If the up_to_version parameter is passed then any versions beyond it are ignored and not returned in the resulting OrderedDict.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
resource_id
|
the resource id |
required | |
up_to_version
|
the maximum version to include in the resulting OrderedDict (inclusive) |
None
|
Returns:
| Type | Description |
|---|---|
Dict[int, DatastoreResourceDetails]
|
None or an OrderedDict of version: DatastoreResourceDetails objects in ascending order |
Source code in ckanext/versioned_datastore/lib/importing/details.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | |
get_details(resource_id, version)
¶
Retrieve the details for a resource at a given version.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
resource_id
|
the resource id |
required | |
version
|
the version to get the details at |
required |
Returns:
| Type | Description |
|---|---|
|
None or a DatastoreResourceDetails object |
Source code in ckanext/versioned_datastore/lib/importing/details.py
37 38 39 40 41 42 43 44 45 46 47 48 49 50 | |
get_details_at(resource_id, version=None)
¶
Retrieve the details that apply at the given version. If the version is None (the default) then the latest details are returned.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
resource_id
|
str
|
the resource ID to get the details for |
required |
version
|
Optional[int]
|
the version of the details to get (or None for latest) |
None
|
Returns:
| Type | Description |
|---|---|
Optional[DatastoreResourceDetails]
|
None if no details were found, or a DatastoreResourceDetails object |
Source code in ckanext/versioned_datastore/lib/importing/details.py
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | |
get_last_file_hash(resource_id)
¶
Retrieves the most recent file hash and returns it. If there is no most recent file hash (either because there isn't a file hash present or because there aren't any details rows available) then this function returns None.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
resource_id
|
the resource id |
required |
Returns:
| Type | Description |
|---|---|
|
None or the most recent file hash |
Source code in ckanext/versioned_datastore/lib/importing/details.py
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | |