Layer¶
-
class
koordinates.layers.
Layer
(**kwargs)¶ Bases:
koordinates.base.Model
Represents a version of a single Layer or Table.
-
create_draft_version
()¶ Creates a new draft version from this model content.
If anything in the data object has changed then an import will begin immediately. Otherwise to force a re-import from the previous sources call
start_import()
.Return type: Layer Returns: the new version Raises Conflict: if there is already a draft version for this layer.
-
delete_layer
()¶ Delete this layer.
-
delete_version
(version_id=None)¶ Deletes this draft version (revert to published)
Raises: - NotAllowed – if this version is already published.
- Conflict – if this version is already deleted.
-
get_draft_version
(expand=[])¶ Get the current draft version of this layer. :raises NotFound: if there is no draft version.
-
get_published_version
(expand=[])¶ Get the latest published version of this layer. :raises NotFound: if there is no published version.
-
get_version
(version_id, expand=[])¶ Get a specific version of this layer
-
list_versions
()¶ Filterable list of versions of a layer, always ordered newest to oldest.
If the version’s source supports revisions, you can get a specific revision using
.filter(data__source__revision=value)
. Specific values depend on the source type. Usedata__source_revision__lt
ordata__source_revision__gte
to filter using<
or>=
operators respectively.
-
publish
(version_id=None)¶ Creates a publish task just for this version, which publishes as soon as any import is complete.
Returns: the publish task Return type: Publish Raises Conflict: If the version is already published, or already has a publish job.
-
save
(with_data=False)¶ Edits this draft layerversion. # If anything in the data object has changed, cancel any existing import and start a new one.
Parameters: with_data (bool) – if True
, send the data object, which will start a new import and cancel any existing one. IfFalse
, the data object will not be sent, and no import will start.Raises NotAllowed: if the version is already published.
-
set_metadata
(fp, version_id=None)¶ Set the XML metadata on this draft version.
Parameters: fp (file) – file-like object to read the XML metadata from. Raises NotAllowed: if this version is already published.
-
start_import
(version_id=None)¶ Starts importing this draft layerversion (cancelling any running import), even if the data object hasn’t changed from the previous version.
Raises Conflict: if this version is already published.
-
start_update
()¶ A shortcut to create a new version and start importing it. Effectively the same as
create_draft_version()
followed bystart_import()
.Return type: Layer Returns: the new version Raises Conflict: if there is already a draft version for this layer.
-
-
class
koordinates.layers.
LayerManager
(client)¶ Bases:
koordinates.base.Manager
Accessor for querying Layers & Tables.
Access via the
layers
property of akoordinates.client.Client
instance.-
create
(layer)¶ Creates a new layer. All attributes except
name
anddata.datasources
are optional. :return: the new draft version of the layer.
-
create_draft
(layer_id)¶ Creates a new draft version.
If anything in the data object has changed then an import will begin immediately. Otherwise to force a re-import from the previous sources call
start_import()
.Return type: Layer Returns: the new version Raises Conflict: if there is already a draft version for this layer.
-
get
(id, expand=[])¶ Fetches a Token determined by the value of id.
Parameters: id – ID for the new Token
object.
-
get_draft
(layer_id, expand=[])¶ Get the current draft version of a layer. :raises NotFound: if there is no draft version.
-
get_published
(layer_id, expand=[])¶ Get the latest published version of this layer. :raises NotFound: if there is no published version.
-
get_version
(layer_id, version_id, expand=[])¶ Get a specific version of a layer.
-
list
()¶ Fetches a set of Tokens
-
list_drafts
()¶ A filterable list views of layers, returning the draft version of each layer. If the most recent version of a layer or table has been published already, it won’t be returned here.
-
list_versions
(layer_id)¶ Filterable list of versions of a layer, always ordered newest to oldest.
If the version’s source supports revisions, you can get a specific revision using
.filter(data__source__revision=value)
. Specific values depend on the source type. Usedata__source_revision__lt
ordata__source_revision__gte
to filter using<
or>=
operators respectively.
-
model
¶ alias of
Layer
-
set_metadata
(layer_id, version_id, fp)¶ Set the XML metadata on a layer draft version.
Parameters: fp (file) – file-like object to read the XML metadata from. Raises NotAllowed: if the version is already published.
-
start_import
(layer_id, version_id)¶ Starts importing the specified draft version (cancelling any running import), even if the data object hasn’t changed from the previous version.
-
start_update
(layer_id)¶ A shortcut to create a new version and start importing it. Effectively the same as
create_draft_version()
followed bystart_import()
.
-
-
class
koordinates.layers.
LayerVersion
(**kwargs)¶ Bases:
koordinates.base.InnerModel
Represents the
version
property of aLayer
instance.
-
class
koordinates.layers.
LayerVersionManager
(client, parent)¶ Bases:
koordinates.base.InnerManager
-
model
¶ alias of
LayerVersion
-