Skip to content

Action

vds_options_get(resource_id, version=None)

Retrieves the options in use by Splitgill for the given resource at the given optional version.

Parameters:

Name Type Description Default
resource_id str

the resource ID

required
version Optional[int]

the version (default is None which means get the latest options)

None

Returns:

Type Description
Optional[dict]

the options as a dict, or None if there are no options available

Source code in ckanext/versioned_datastore/logic/options/action.py
16
17
18
19
20
21
22
23
24
25
26
27
@action(schema.vds_options_get(), helptext.vds_options_get, get=True)
def vds_options_get(resource_id: str, version: Optional[int] = None) -> Optional[dict]:
    """
    Retrieves the options in use by Splitgill for the given resource at the given
    optional version.

    :param resource_id: the resource ID
    :param version: the version (default is None which means get the latest options)
    :returns: the options as a dict, or None if there are no options available
    """
    options = get_options(resource_id, version)
    return None if options is None else options.to_doc()

vds_options_update(resource_id, overrides)

Updates the options for the given resource with the new values in the overrides parameter. The existing options are retrieved and then the new options in the overrides dict are written over the top. This allows incremental updates to the existing options. If no options exist, the default options are used as a base.

Parameters:

Name Type Description Default
resource_id str

the resource ID

required
overrides dict

a dict of override options to apply

required

Returns:

Type Description
Optional[int]

the new options version, or None if nothing was changed

Source code in ckanext/versioned_datastore/logic/options/action.py
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
@action(schema.vds_options_update(), helptext.vds_options_update)
def vds_options_update(
    resource_id: str,
    overrides: dict,
) -> Optional[int]:
    """
    Updates the options for the given resource with the new values in the overrides
    parameter. The existing options are retrieved and then the new options in the
    overrides dict are written over the top. This allows incremental updates to the
    existing options. If no options exist, the default options are used as a base.

    :param resource_id: the resource ID
    :param overrides: a dict of override options to apply
    :returns: the new options version, or None if nothing was changed
    """
    if is_resource_read_only(resource_id):
        raise ReadOnlyResourceException('This resource has been marked as read only')

    return update_options(resource_id, overrides)