You need to have write permission on the collection to be able to ingest data.
Dataset schema
Tilebox Datasets are strongly typed. This means you can only ingest data that matches the schema of a dataset. The schema is defined during dataset creation time. The examples on this page assume that you have access to a Timeseries dataset that has the following schema:MyCustomDataset schema
MyCustomDataset schema
MyCustomDataset schema
Prepare data for ingestion
Ingestion is available in Python and Go.Python
Every datapoint passed tocollection.ingest must include time. Omit id and ingestion_time; Tilebox generates both fields during ingestion.
Record-oriented data
Use an iterable of mappings when you construct datapoints individually. Optional fields can be absent from individual records.None and common tabular missing values also leave optional fields unset.
Python
Column-oriented data
Use a mapping of field names to equally sized sequences when your data is already organized by column.Python
A mapping is always interpreted as column-oriented data. To ingest one record, wrap it in a list:
collection.ingest([record]).pandas DataFrame
Tilebox treats each DataFrame row as one datapoint and maps column names to dataset fields.Python
xarray Dataset
Tilebox also acceptsxarray.Dataset, the format returned when querying data.
Python
Array fields use an extra xarray dimension, such as
n_sensor_history. If array lengths differ, pad shorter values at the end with the fill value for that data type. Tilebox omits this trailing padding during ingestion.Go
Client.Datapoints.Ingest supports ingestion of data points in the form of a slice of protobuf messages.
Protobuf
Protobuf is Google’s language-neutral, platform-neutral, extensible mechanism for serializing structured data. More details on protobuf can be found in the protobuf section. In the example below, thev1.Modis type has been generated with tilebox dataset generate, as described in the protobuf section.
Go
Copying or moving data
Sinceingest takes query’s output as input, you can easily copy or move data from one collection to another.
Automatic batching
Tilebox automatically batches the ingestion requests for you, so you don’t have to worry about the maximum request size.Idempotency
Tilebox will auto-generate datapoint IDs based on the data of all its fields - except for the auto-generatedingestion_time, so ingesting the same data twice will result in the same ID being generated. By default, Tilebox
will silently skip any data points that are duplicates of existing ones in a collection. This behavior is especially
useful when implementing idempotent algorithms. That way, re-executions of certain ingestion tasks due to retries
or other reasons will never result in duplicate data points.
You can instead also request an error to be raised if any of the generated datapoint IDs already exist.
This can be done by setting the allow_existing parameter to False.
Ingestion from common file formats
Through the usage ofxarray and pandas you can also easily ingest existing datasets available in file
formats, such as CSV, Parquet, Feather and more.
Check out the Ingestion from common file formats guide for examples of how to achieve this.