Skip to content

vdk-postgres: type inference for ingestion #3218

@DeltaMichael

Description

@DeltaMichael

Overview

The postgres plugin does not infer the types based on the existing table when doing ingestion. The plugin should infer the types based on the columns, even though strings are passed. The below code should work and write float value in the float_data column and and integer value in the int_data column, even though they're passed as strings in the payload.

create table test_table (
    id number,
    str_data varchar2(255),
    int_data number,
    nan_int_data number,
    float_data float,
    bool_data number(1),
    timestamp_data timestamp,
    decimal_data decimal(14,8),
    primary key(id))
import math


def run(job_input):
    payload = {
        "id": "5",
        "str_data": "string",
        "int_data": "12",
        "nan_int_data": math.nan,
        "float_data": "1.2",
        "bool_data": "False",
        "timestamp_data": "2023-11-21T08:12:53.43726",
        "decimal_data": "0.1",
    }

    job_input.send_object_for_ingestion(payload=payload, destination_table="test_table")

Acceptance Criteria

  1. The above scenario is supported

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions