Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add boolean setting to include string size in schema discovery #45

Closed
haleemur opened this issue Sep 11, 2024 · 2 comments
Closed

Add boolean setting to include string size in schema discovery #45

haleemur opened this issue Sep 11, 2024 · 2 comments

Comments

@haleemur
Copy link
Contributor

Description

Include a tap setting discover_string_field_size (happy to pick a different name for this field, this is the first thing that came to mind). Setting this to true would discovery string fields' types as

"<field_name>": {"type": ["string", "null"], "maxLength": X}"

where X, a positive integer, is the output of this query

select character_maximum_length 
from information_schema.columns 
where table_name = <table_name> 
  and table_schema = <table_schema>
  and column_name = <field_name>

Use Case

May targets map string types to a size-independent type (e.g. postgres: string, snowflake: string, bigquery: string). These targets can ignore the maxLength attribute.

Some targets have to map strings to varchar and specify a size. In these cases, it is necessary to know the maxLength

Default Behaviour & Default Value

The setting should be false by default to preserve existing behaviour. Users will have to specify this setting when configuring meltano.

@edgarrmondragon
Copy link
Member

edgarrmondragon commented Sep 11, 2024

The SDK v0.41.0 will make this significantly easier fwiw: https://sdk.meltano.com/en/latest/guides/sql-tap.html#custom-type-mapping

Nevermind, it will actually make it the default 😅

meltano/sdk@4ce312f

@haleemur
Copy link
Contributor Author

In that case, I'll close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

2 participants