Utils
convert_small_or_groups(query)
¶
Convert OR groups containing only 1 item to AND groups.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query
|
a multisearch query dict |
required |
Returns:
| Type | Description |
|---|---|
|
the query with a converted filter dict, if applicable |
Source code in ckanext/versioned_datastore/lib/query/utils.py
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | |
convert_to_multisearch(query)
¶
Converts the given basic query dict into a multisearch query and returns it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query
|
dict
|
a basic query dict |
required |
Returns:
| Type | Description |
|---|---|
dict
|
a multisearch query dict |
Source code in ckanext/versioned_datastore/lib/query/utils.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 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 113 114 115 116 | |
get_resources_and_versions(query, allow_non_datastore=False)
¶
Given a query on some resources, returns a dict of resource IDs to versions which should be queried based on the overall query version. The version provided with each resource ID in the dict will be the rounded version, representing the version of the data which should be queried to get the data at the overall version.
This function also filters out resources the user doesn't have access to.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query
|
SchemaQuery
|
a SchemaQuery object representing the query |
required |
allow_non_datastore
|
bool
|
allow non datastore resources to be included (will be returned with common.NON_DATASTORE_VERSION) |
False
|
Returns:
| Type | Description |
|---|---|
Dict[str, int]
|
a dict of resource IDs and versions |
Source code in ckanext/versioned_datastore/lib/query/utils.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | |
remove_empty_groups(query)
¶
Remove empty groups from filter list.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query
|
a multisearch query dict |
required |
Returns:
| Type | Description |
|---|---|
|
the query with a processed filter dict, if applicable |
Source code in ckanext/versioned_datastore/lib/query/utils.py
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | |