meltano / sdk

Write 70% less code by using the SDK to build custom extractors and loaders that adhere to the Singer standard: https://sdk.meltano.com
https://sdk.meltano.com
Apache License 2.0
100 stars 70 forks source link

SQL Targets: varchar columns generally require maxlength #368

Closed MeltyBot closed 2 years ago

MeltyBot commented 2 years ago

Migrated from GitLab: https://gitlab.com/meltano/sdk/-/issues/371

Originally created by @tbriggs2 on 2022-05-04 15:27:03


Summary

Most databases require a max length to be specified for varchar columns. Not all do (SQLite, Postgres, and Snowflake do not) but most do. The SDK currently creates varchar columns without a max length and thus table creation fails when the DB requires it. If the schema provided by the tap provides a max length it should be used.

Steps to reproduce

  1. Create a SQL target using the SDK for a database such as MySQL
  2. Feed the target data with a stream containing a string field where the schema record specifies a max length

What is the current bug behavior?

Creation of the table in the destination DB will fail due to a lack of a length.

What is the expected correct behavior?

If the tap provides a max length in the schema record it should be used.

Possible fixes

The relevant code is in singer_sdk/typing.py. MR incoming too.

MeltyBot commented 2 years ago

View 3 previous comments from the original issue on GitLab