> ## Documentation Index
> Fetch the complete documentation index at: https://docs.streamkap.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Schema Transforms Supported Types

> Mapping Kafka Data Types and SQL Types.

Very simple example of a JSON payload:

```json theme={null}
{
  "id" : 1,
  "customer_id" : 1234,
  "customer_name" : "John Doe"
}
```

And the corresponding schema:

```json theme={null}
{
  "type" : "struct",
  "fields" : [ {
    "type" : "int64",
    "optional" : false,
    "field" : "id"
  }, {
    "type" : "int64",
    "optional" : false,
    "field" : "customer_id"
  }, {
    "type" : "string",
    "optional" : false,
    "field" : "customer_name"
  } ],
  "optional" : false
}
```

To make it easier to use the Kafka types, please find below the list of supported types mapped to usual SQL types that might be found in source database.

| Kafka Type                                                                                                                                     | SQL Type (PostgreSQL) | SQL Type (MySQL) | SQL Type (Oracle) |
| ---------------------------------------------------------------------------------------------------------------------------------------------- | --------------------- | ---------------- | ----------------- |
| int8                                                                                                                                           | SMALLINT              | TINYINT          | NUMBER(3)         |
| int16                                                                                                                                          | INTEGER               | SMALLINT         | NUMBER(5)         |
| int32                                                                                                                                          | INTEGER               | INT              | NUMBER(10)        |
| int64                                                                                                                                          | BIGINT                | BIGINT           | NUMBER(19)        |
| float                                                                                                                                          | REAL                  | FLOAT            | NUMBER(7, 2)      |
| double                                                                                                                                         | DOUBLE PRECISION      | DOUBLE           | NUMBER(15, 6)     |
| string                                                                                                                                         | VARCHAR               | VARCHAR          | VARCHAR2          |
| bytes                                                                                                                                          | BYTEA                 | BLOB             | BLOB              |
| boolean                                                                                                                                        | BOOLEAN               | BOOLEAN          | NUMBER(1)         |
| `{"type":"int64","optional":false,"name":"org.apache.kafka.connect.data.Timestamp"}`                                                           | TIMESTAMP             | TIMESTAMP        | TIMESTAMP         |
| `{"type":"bytes","optional":false,"name":"org.apache.kafka.connect.data.Decimal","parameters":{"scale":"4","connect.decimal.precision":"38"}}` | DECIMAL(38,4)         | DECIMAL(38,4)    | DECIMAL(38,4)     |
| `{"type":"int32","optional":false,"name":"org.apache.kafka.connect.data.Date"}`                                                                | DATE                  | DATE             | DATE              |
| `{"type":"int64","optional":false,"name":"org.apache.kafka.connect.data.Time"}`                                                                | TIME                  | TIME             | N/A               |

DECIMAL(38,4) means a decimal number with up to 38 digits in total, of which 4 digits can be after the decimal point, one can adjust the precision if needed.

Please see the example of primitive Kafka Schema definitions and their corresponding payloads:

```text theme={null}
{"schema":{"type":"boolean","optional":false,"default":false},"payload":false}
{"schema":{"type":"int8","optional":false,"default":1},"payload":1}
{"schema":{"type":"int16","optional":false,"default":1},"payload":1}
{"schema":{"type":"int32","optional":false,"default":1},"payload":1}
{"schema":{"type":"int64","optional":false,"default":1},"payload":1}
{"schema":{"type":"float","optional":false,"default":1.0},"payload":1.0}
{"schema":{"type":"double","optional":false,"default":1.0},"payload":1.0}
{"schema":{"type":"bytes","optional":false,"default":"Zm9v"},"payload":"Zm9v"}
{"schema":{"type":"string","optional":false,"default":"foo"},"payload":"foo"}
{"schema":{"type":"bytes","optional":false,"name":"org.apache.kafka.connect.data.Decimal","parameters":{"scale":"4","connect.decimal.precision":"38"},"default":"EtaH"},"payload":"EtaH"}
{"schema":{"type":"int64","optional":false,"name":"org.apache.kafka.connect.data.Timestamp","default":1758635042028},"payload":1758635042028}
{"schema":{"type":"int64","optional":false,"name":"org.apache.kafka.connect.data.Time","default":55800000},"payload":55800000}
{"schema":{"type":"int32","optional":false,"name":"org.apache.kafka.connect.data.Date","default":20370},"payload":20370}
```
