catalog layer partition
catalog layer partition
The OLP CLI supports the following:
- list partitions in a layer
- get partitions from a layer
- put partitions in a layer
- delete partitions in a layer
catalog layer partition list
Lists the names of all partitions in the specified catalog layer; either versioned, volatile, or index.
olp catalog layer partition list <catalog HRN> <layer ID> [command options]
NoteThe
olp catalog layer partition listcommand output is limited to 100,000 partitions. If this limit is exceeded, the following warning message appears: "WARNING: The limit of 100,000 partitions has been reached" The warning message appears only if the command has been executed without the--jsonor--quietflag.
Required parameters:
-
<catalog HRN>The HRN of the catalog. -
<layer ID>The ID of the layer; either versioned, volatile, or index. For stream layers, see Stream commands -
--filter <filter query>The query string required for Index layers. The<filter query>must be written in Feed Item Query Language. We recommend using the=lt=,=le=,=gt=, or=ge=comparison operators instead of the<,<=,>, or>=operators on Windows. All special characters inside the<filter query>should be escaped or quoted.Note--filter <filter query>is optional for versioned and volatile layers, where it is used as a prefix to filter partitions bypartition name.
Optional parameters:
--credentials <path to credentials file>The name of a credentials file to use with the command. Credentials files are downloaded separately from the platform portal.--profile <profile name>The name of the credentials profile to use from theolpcli.inifile.--jsonDisplays the command result in JSON format.--quietDisplays partition names, each on a new line.--scope <project HRN>Specifies the project HRN to use as the scope in the request. The value specified with--scopeoverrides any value forhere.token.scopeprovided in the credentials file used for the command.
Optional parameters for a versioned layer:
--version <catalog version>The catalog's metadata version.--change startVersion:[endVersion]Get metadata for the latest partition changes for a version range in a versioned layer. Only the latest change for each changed partition is returned, not intermediate changes. If the response contains a partition with an emptydataHandlevalue, it means that the partition was deleted. If a partition was created and deleted between the versions specified in thestartVersionandendVersionparameters, the partition is included in the response with an emptydataHandlevalue. For example, if you request versions0to10, and a partition was created in version3and then deleted in version7, it is included in the response with an emptydataHandlevalue. IfendVersionis not specified, the latest version of the catalog metadata will be used.--context <default|super|extension>The context where the operation will be performed on composite layers. Available context are:defaultFor composite layers, the operation is executed for both the current layer and the layer it extends. For normal layers, this is the only valid context.extensionThe operation will be executed only in the extension, and no operation will be performed in the extended layer.superThe operation will be executed only in the layer being extended.
Optional parameters for a volatile layer:
--modified-since <YYYY-MM-DDThh:mm:ss>Filters the partitions for volatile layers based on when they were last modified. The timestamp must match the ISO-8601 format YYYY-MM-DDThh:mm:ss but only YYYY is mandatory. To skip values in the timestamp, you must start from the least significant value, from right to left.
For more information on using credentials and profiles, see Credentials setup.
Example:
The command below lists all partitions from layer1 in the catalog
catalog1.
olp catalog layer partition list hrn:here:data::org:catalog1 layer1Output:
partition size dataHandle checksum CRC
testPartition 23 3f24f359-4b6d-4d51-a39f-1140r112w111
Total size: 23 B
Use olp catalog layer partition get <catalog HRN> <layer ID> to download partitionscatalog layer partition get
Downloads the partitions that are specified with the --partitions
parameter in the catalog layer.
olp catalog layer partition get <catalog HRN> <layer ID> [command options]
NotePartition(s) will be automatically decompressed during
olp catalog layer partition getcommand execution if the layer was created with the--content-encoding <gzip>parameter.
Required parameters:
<catalog HRN>The HRN of the catalog.<layer ID>The ID of the layer to use; either versioned, volatile, or index. For stream layers, see catalog layer stream commands.
Required parameters for an index layer:
--filter <filter query>The query string required for Index layers. The<filter query>must be written in Feed Item Query Language. We recommend using the=lt=,=le=,=gt=, or=ge=comparison operators instead of the<,<=,>, or>=operators on Windows. All special characters inside the<filter query>should be escaped or quoted. This parameter is optional for versioned and volatile layers, where it is used as a prefix to filter the partitions bypartition name.
Optional parameters:
-
--partitions <partitionID1 partitionID2 ...>The partitions to download. If only one partition is specified and no output folder is provided, the partition content is retrieved into the standard output. If the partition content is retrieved into the standard output, the--modified-sinceparameter is used, and there are no modifications after the date provided, then the command execution finishes with the exit code 4.NoteThe command can produce empty output when trying to write the content of the partition that contains non-ASCII symbols to stdout. This is a Windows-specific problem, related to the peculiarity of rendering UTF-8 symbols on Windows console. As a workaround, please redirect command output to a file or specify the output directory with the
--outputparameter. -
--allDownloads all partitions in the layer. -
--parallelism <number>Configure the number of concurrent download requests.NoteWhen processing large numbers of partitions, command now automatically switches to
PERFORMANCEclient configuration mode, which optimizes HTTP connection pooling and allows more open connections. -
--output <path to dir>The output directory to store the downloaded partitions. If the specified directory doesn't exist, it is automatically created. If no directory is specified, the default value is<current dir>/<catalog HRN>. -
--credentials <path to credentials file>The name of a credentials file to use with the command. Credentials files are downloaded separately from the platform portal. -
--profile <profile name>The name of the credentials profile to use from theolpcli.inifile. -
--quietDisplays the absolute path to the output directory. -
--scope <project HRN>Specifies the project HRN to use as the scope in the request. The value specified with--scopeoverrides any value forhere.token.scopeprovided in the credentials file used for the command.
NoteFor versioned or volatile layers, you must specify either the
--allor the--partitionsparameter.
Optional parameters for a versioned layer:
--version <catalog version>The catalog's metadata version.--decode <true|false>Determines whether the partition content is decoded from protobuf and converted to JSON on-the-fly. The default value isfalse, which means the content is not decoded. You can specify the path to a schema on a local file system with--decode <true|false:[path/to/schema.zip]>; otherwise, the default schema linked to the layer is used. An exception is thrown when there is no schema linked to the layer or no path to a local schema ZIP provided. Schemas can be downloaded from the HERE platform portal or with theolp schema getcommand. Using--decode truewith--outputor--allparameters produces files where the following name pattern is used:<partition-name>-decoded.json.--context <default|super|extension>The context where the operation will be performed on composite layers. Available context are:defaultFor composite layers, the operation is executed for both the current layer and the layer it extends. For normal layers, this is the only valid context.extensionThe operation will be executed only in the extension, and no operation will be performed in the extended layer.superThe operation will be executed only in the layer being extended.
Optional parameters for a volatile layer:
--modified-since <YYYY-MM-DDThh:mm:ss>Filters the partitions for volatile layers based on when they were last modified. The timestamp must match the ISO-8601 format YYYY-MM-DDThh:mm:ss, but only YYYY is mandatory. To skip values in the timestamp, you must start from the least significant value, from right to left.--decode <true|false>Determines whether the partition content is decoded from protobuf and converted to JSON on-the-fly. The default value isfalse, which means the content is not decoded. You can specify the path to a schema on a local file system with--decode <true|false:[path/to/schema.zip]>; otherwise, the default schema linked to the layer is used. An exception is thrown when there is no schema linked to the layer or no path to a local schema ZIP provided. Schemas can be downloaded from the HERE platform portal or with theolp schema getcommand. Using--decode truewith--outputor--allparameters produces files where the following name pattern is used:<partition-name>-decoded.json.
For more information on using credentials and profiles, see Credentials setup.
Example:
The command below retrieves the partition content into the standard output if you specify only one partition.
olp catalog layer partition get hrn:here:data::org:catalog1 layer1 \
--partitions partition1olp catalog layer partition get hrn:here:data::org:catalog1 layer1 ^
--partitions partition1Output:
Partition content exampleExample:
The command below downloads partition1 from layer1 in catalog1 to the specified output file.
olp catalog layer partition get hrn:here:data::org:catalog1 layer1 \
--partitions partition1 > PATH/TO/OUTPUT_FILEolp catalog layer partition get hrn:here:data::org:catalog1 layer1 ^
--partitions partition1 > PATH/TO/OUTPUT_FILEExample:
The command below downloads partition1 and partition2 from version 1
of versioned-layer in catalog1 to the specified output directory.
olp catalog layer partition get hrn:here:data::org:catalog1 versioned-layer \
--partitions partition1 partition2 --output PATH/TO/OUTPUT_DIRECTORY --version 1olp catalog layer partition get hrn:here:data::org:catalog1 versioned-layer ^
--partitions partition1 partition2 --output PATH/TO/OUTPUT_DIRECTORY --version 1Output:
0% [> ] 0/2 (0:00:00 / ?)
0% [> ] 0/2 (0:00:00 / ?)
100% [=============================================] 2/2 (0:00:00 / 0:00:00)
Partitions: partition1,partition2 were successfully downloaded to PATH/TO/OUTPUT_DIRECTORYExample:
To customize the path where the partition is saved, concatenate the
relative or the absolute path with the partition name, using a colon (:).
olp catalog layer partition get hrn:here:data::org:catalog1 layer1 \
--partitions partition_name:PATH/TO/OUTPUT_DIRECTORYolp catalog layer partition get hrn:here:data::org:catalog1 layer1 ^
--partitions partition_name:PATH/TO/OUTPUT_DIRECTORYOutput:
0% [> ] 0/1 (0:00:00 / ?)
0% [> ] 0/1 (0:00:00 / ?)
100% [=============================================] 1/1 (0:00:00 / 0:00:00)
Partition partition_name was successfully downloaded to PATH/TO/OUTPUT_DIRECTORYExample:
The command below retrieves all partitions from the index layer that were uploaded
on January 1, 2020, between 00:01:00 AM and 00:05:00 AM with locationTag equal to 4242.
olp catalog layer partition get hrn:here:data::org:catalog1 layer1 \
--filter "ingestionTime>1577836860;ingestionTime<1577837100;locationTag==4242"
--output PATH/TO/OUTPUT_DIRECTORYolp catalog layer partition get hrn:here:data::org:catalog1 layer1 ^
--filter "ingestionTime>1577836860;ingestionTime<1577837100;locationTag==4242"
--output PATH/TO/OUTPUT_DIRECTORYOutput:
0% [> ] 0/3 (0:00:00 / ?)
0% [> ] 0/3 (0:00:00 / ?)
0% [> ] 0/3 (0:00:00 / ?)
100% [=============================================] 3/3 (0:00:00 / 0:00:00)
Partitions: partition1,partition2,partition3 were successfully downloaded to PATH/TO/OUTPUT_DIRECTORY
NoteThe
--filtervalue depends on the--index-fieldsvalue that was specified during partitions upload (olp catalog layer partition putcommand execution). Also, note that the--index-fieldsvalue depends on the--index-definitionsvalue specified during index layer creation -catalog layer addcommand execution.
Query Performance Tips
- Use the
timewindowindexing attribute in the query. - To get results back within a short period of time, you should split
queries based on
timewindowso that the data in thetimewindowrange is manageable (100,000 or less). - Limit the usage of additional constraints.
catalog layer partition put
Publishes the specified files to the specified partitions.
olp catalog layer partition put <catalog HRN> <layer ID> [command options]
NotePartition(s) content will be automatically compressed during the
olp catalog layer partition putcommand execution if the layer was created with the--content-encoding <gzip>parameter.
Required parameters:
<catalog HRN>The HRN of the catalog.<layer ID>The ID of the layer to upload partition(s) to; either versioned, volatile, or index. For stream layers, see catalog layer stream commands.
Required parameters for an index layer:
-
--index-fields <bool|int|string|heretile|timewindow>:<index-key>:<index-value>A list of index fields for this publication. The<timewindow>index field definition is required and should be the same as was specified in the layer's index definitions.If the
--index-fieldsparameter is not passed and the--inputparameter is passed, the application tries to read the index configuration from theindex.propertiesfile located in the--inputpath. The format of theindex.propertiesfile is the following:fileMaskA regular expression used to filter files in the input directory.indexTypeAn index type name with these acceptable values:bool,int,string,heretile,timewindow. You must definetimewindowthat should be the same as the one specified in the layerindex-definitions.indexKeyAn index name. This key is used for listing index partitions.indexValueThe value of the index. The value oftimewindowshould be the same as the one specified in the layerindex-definitions.
The following example sets the
timewindowindexmyIndexto50000for all the files whose names start with file and one digit likefile1.bin,file2.txt, and the like. Add the boolean index keymyBoolIndexset totrueto thefile1.binfile.
fileMask=file[0-9].*
indexType=timewindow
indexKey=myIndex
indexValue=50000
fileMask=file1.bin
indexType=bool
indexKey=myBoolIndex
indexValue=true
An empty line between index definitions is not required but it improves the
readability of the config. The values for all configuration keys
(fileMask, indexType, indexKey, indexValue) are required.
If both of the --index-fields and --input parameters are passed, then
the configurations from index.properties are ignored.
Optional parameters:
-
--partitions <partition ID>:<path to file>The partitions and files to upload. -
--parallelism <number>Configure the number of concurrent upload requests.NoteWhen processing large numbers of partitions, command now automatically switches to
PERFORMANCEclient configuration mode, which optimizes HTTP connection pooling and allows more open connections. -
--input <path to dir>/<glob-pattern>The input directory, single file, or filename glob pattern (non-recursive) from which to upload the files; supports relative paths; hidden files are skipped.
NoteIf neither
--inputnor--partitionsparameters are specified, nothing will be uploaded, butmetadataVersionwill be incremented.If you wish to use both the
--partitionsand--inputoptions, specify the directory containing the files you wish to put with the--inputoption. Then, specify the relative paths to the individual files you wish to put from that directory using the--partitionsparameter.
--dependency <catalog-hrn:version[:direct]>List of the dependencies for this publication wheredirectis either true or false, and its default value is true.--credentials <path to credentials file>The name of a credentials file to use with the command. Credentials files are downloaded separately from the platform portal.--profile <profile name>The name of the credentials profile to use from theolpcli.inifile.--quietDisplays empty output with no additional information.--scope <project HRN>Specifies the project HRN to use as the scope in the request. The value specified with--scopeoverrides any value forhere.token.scopeprovided in the credentials file used for the command.
For more information on using credentials and profiles, see Credentials setup.
Optional parameters for a versioned layer:
--encode <true|false:[path/to/schema.zip]>Determines whether the partition content is encoded from JSON and converted to protobuf on-the-fly. The default value isfalse, which means the content is not encoded. You can specify the path to a schema on a local file system; otherwise, the default schema linked to the layer is used. An exception is thrown when there is no schema linked to the layer or no path to a local schema ZIP provided. Schemas can be downloaded from the HERE platform portal or with theolp schema getcommand.
NoteYou can encode only the JSON file that you got from the
olp catalog layer partition getcommand.
Optional parameters for a volatile layer:
--encode <true|false:[path/to/schema.zip]>Determines whether the partition content is encoded from JSON and converted to protobuf on-the-fly. The default value isfalse, which means the content is not encoded. You can specify the path to a schema on a local file system; otherwise, the default schema linked to the layer is used. An exception is thrown when there is no schema linked to the layer or no path to a local schema ZIP provided. Schemas can be downloaded from the HERE platform portal or with theolp schema getcommand.
NoteYou can encode only the JSON file that you got from the
olp catalog layer partition getcommand.
Optional parameters for an index layer:
--metadata <key1=val1 key2=val2 ...>List of all user-defined fields that can store extra information. If the--inputparameter is provided, the metadata applies to all the files located in the input directory.
Example:
The command below uploads file1 and file2 to partition1 and partition2
respectively from the folder relative to the current folder.
olp catalog layer partition put hrn:here:data::org:catalog1 layer1 \
--partitions partition1:PATH/TO/FILE1 partition2:PATH/TO/FILE2olp catalog layer partition put hrn:here:data::org:catalog1 layer1 ^
--partitions partition1:PATH/TO/FILE1 partition2:PATH/TO/FILE2Output:
0% [> ] 0/2 (0:00:00 / ?)
0% [> ] 0/2 (0:00:00 / ?)
100% [=============================================] 2/2 (0:00:00 / 0:00:00)
Partitions partition1, partition2 were successfully uploadedExample:
If you specify only one partition, the command retrieves the partition content
into the standard output. For more information, see
olp catalog layer partition get.
OLP CLI lets you chain both get and put commands when you retrieve
content into the standard output. This means that you can omit the path to
the partition and use a hyphen (-) instead.
olp catalog layer partition get hrn:here:data::org:catalog-1 versioned-layer1 \
--partitions partition1 | olp catalog layer partition put hrn:here:data::org:catalog-2 \
versioned-layer1 --partitions partition1:-olp catalog layer partition get hrn:here:data::org:catalog-1 versioned-layer1 ^
--partitions partition1 | olp catalog layer partition put hrn:here:data::org:catalog-2 ^
versioned-layer1 --partitions partition1:-Output:
0% [> ] 0/1 (0:00:00 / ?)
0% [> ] 0/1 (0:00:00 / ?)
100% [=============================================] 1/1 (0:00:00 / 0:00:00)
Partition partition1 was successfully uploadedExample:
The command below uploads file1 and file2 to partition1 and partition2
respectively to the index layer with the --index-fields parameter equal to
timewindow:ingestionTime:1577836960 int:locationTag:4242
NoteThe
--index-fieldsvalue depends on the--index-definitionsvalue specified during index layer creation -olp catalog layer addcommand execution.
olp catalog layer partition put hrn:here:data::org:catalog1 layer1 \
--partitions partition1:PATH/TO/FILE1 partition2:PATH/TO/FILE2
--index-fields timewindow:ingestionTime:1577836960 int:locationTag:4242olp catalog layer partition put hrn:here:data::org:catalog1 layer1 ^
--partitions partition1:PATH/TO/FILE1 partition2:PATH/TO/FILE2
--index-fields timewindow:ingestionTime:1577836960 int:locationTag:4242Output:
0% [> ] 0/2 (0:00:00 / ?)
0% [> ] 0/2 (0:00:00 / ?)
100% [=============================================] 2/2 (0:00:00 / 0:00:00)
Partitions partition1, partition2 were successfully uploadedcatalog layer partition delete
Deletes partitions from an index layer by the --filter query. Note that this
command does not support data deletion from versioned and volatile layers.
olp catalog layer partition delete <catalog HRN> <layer ID> [command options]Required parameters:
<catalog HRN>The HRN of the catalog.<layer ID>The ID of the layer to delete partitions from.--filter <filter query>The query string required to query data that should be deleted from the index layer. The<filter query>value must be written in the Feed Item Query Language. We recommend using the=lt=,=le=,=gt=, or=ge=comparison operators instead of the<,<=,>, or>=operators on Windows. All special characters inside<filter query>should be escaped or quoted.
Optional parameters:
--timeout <duration in seconds>The timeout duration of the delete request in seconds. If not specified, the default is3600.--credentials <path to credentials file>The name of a credentials file to use with the command. Credentials files are downloaded separately from the platform portal.--profile <profile name>The name of the credentials profile to use from theolpcli.inifile.--quietDisplays empty output with no additional information.
Example:
The command below deletes partitions with keys testIndex==3600000 and
env==4242.
olp catalog layer partition delete hrn:here:data::org:catalog1 indexLayer1 \
--filter "testIndex==3600000;env==4242"olp catalog layer partition delete hrn:here:data::org:catalog1 indexLayer1 ^
--filter "testIndex==3600000;env==4242"Output:
Please wait while the partitions are being deleted. This may take several minutes
1 partition has been successfully deletedFor more information on using credentials and profiles, see Credentials setup.
Updated 21 days ago