Skip to content
This repository was archived by the owner on Sep 23, 2024. It is now read-only.
This repository was archived by the owner on Sep 23, 2024. It is now read-only.

Empty strings get stored as null #68

Open
@tombriggsallego

Description

@tombriggsallego

Describe the bug
An incoming value of "" gets sent to the database as NULL. In most cases this isn't a big deal (though it's not technically correct...) but we have a table where a field containing empty strings is part of the PK, so the value sent to Postgres can't be NULL. (Our source in this case is MySQL but I don't think that actually matters.)

To Reproduce
Steps to reproduce the behavior:

  1. Create a table in MySQL with a varchar not null in the PK, e.g.
CREATE TABLE EmptyStringTest (x int NOT NULL, y varchar(10) NOT NULL, PRIMARY KEY (x,y))
  1. Add a row where the varchar column in the PK is the empty string
INSERT INTO EmptyStringTest VALUES(1, '')
  1. Setup and run a pipeline from MySQL to Postgres
  2. Execution will fail with a "column cannot be null" error

This doesn't seem to be a problem with columns that are not part of a PK as they seem to be created as nullable in the target even if they're declared NOT NULL in the source.

Expected behavior
The value inserted in PG should be an empty string

Environment

  • Version of target: github latest
  • Version of python 3.8
  • Meltano latest

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions