Create a Transform with a Write Schema

Next, you need to provide instructions on your data should be transformed when Hydrolix ingests it. It's a simple mapping from field name to type. This configuration file is also known as a write schema.

Hydrolix has a more expressive type system than JSON (or CSV, which has none). For example, you can use signed and unsigned ints of various widths, arrays of any type, and timestamps with date time format or unix epoch to millisecond precession. Your transform configuration will lead to more compression (smaller storage footprint), faster computations, and a happier data footprint.

Here is a simple example with a few fields. The example uses datetime in golang format. If you're not used to seeing this format, you can check here for examples.

curl -X POST 'https://my-domain.hydrolix.live/config/v1/orgs/{{org_uuid}}/projects/{{project_uuid}}/tables/{{table_uuid}}/transforms/' \
-H 'Authorization: Bearer thebearertoken1234567890abcdefghijklmnopqrstuvwxyz' \
-H 'Content-Type: application/json' \
-d '{
  "name": "mytransformname",
  "description": " a description of transform",
  "type": "json",
  "settings": {
    "is_default": true,
    "output_columns": [
      {
        "name": "timestamp",
        "datatype": {
          "type": "datetime",
          "format": "2006-01-02 15:04:05",
          "primary": true,
          "resolution": "seconds"
        }
      },
      {
        "name": "imabignumber",
        "datatype": {
          "type": "uint64"
        }
      },
      {
        "name": "stringoftext",
        "datatype": {
          "type": "string"
        }
      },
      {
        "name": "arrayofstrings",
        "datatype": {
          "type": "array",
          "elements": [
            {
              "type": "string"
            }
          ]
        }
      }
    ]
  }
}

As with all API responses, you will find a transform uuid in the response. You can use the uuid to make a PATCH or PUT request if you make any mistakes or want to extend your transform.

Learn more about the full range of Data Types and Transforms (Write Schema).