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

Why TINYINT(1) is mapped to boolean? #82

Open
koszti opened this issue Dec 16, 2018 · 2 comments
Open

Why TINYINT(1) is mapped to boolean? #82

koszti opened this issue Dec 16, 2018 · 2 comments

Comments

@koszti
Copy link

koszti commented Dec 16, 2018

TINYINT(1) is currently mapped to BOOLEAN at: https://github.com/singer-io/tap-mysql/blob/master/tap_mysql/__init__.py#L89

Following the MySQL spec , TINYINT(1) is one byte length and can store 256 different values hence it's not only TRUE or FALSE. Is this a bug or I don't understand something here?

@dmosorast
Copy link
Contributor

@koszti That's a good point, according strictly to the spec, it's not entirely accurate to type it as a boolean due to the implemented bit width. This behavior was implemented to be in line with a common use case of tinyint(1) data types as an alias for BOOLEAN, mentioned here. During development, I believe we came upon enough cases where this is the intended behavior to warrant this change.

That said, I could see this being overridden using a configuration option (in the config.json) or metadata on a column (in the catalog.json) if that would be preferable.

@dhines01
Copy link

@dmosorast Is this override logic already available? If so, could you provide an example of what the overridden config.json or catalog.json would look like? Are we simply able to specify that, for example, a TINYINT(1) in the DB should be exported as a SMALLINT(1), or other appropriate data type?

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

No branches or pull requests

3 participants