-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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 Column.is_number/is_float (#1969) #2046
Conversation
Split out snowflake column type added column type test integration tests
b70989a
to
54b64f8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to give this another quick pass, but it broadly looks good to me
def is_numeric(self) -> bool: | ||
return self.dtype.lower() in ['numeric', 'number'] | ||
return self.dtype.lower() in ['numeric', 'decimal'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is the only thing in this PR that I'm not sure about -- do you know why number
was in here before? I tried looking through the blame but couldn't find the origin.... AFAICT number
is not a valid type on pg/redshift/snowflake/bq.....?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's only valid on snowflake, and previously this method applied for Snowflake as well as postgres/redshift. That's why I removed it when I split snowflake out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ship it!
Fixes #1969
A fun question to think about: on snowflake, is nothing an integer, or is everything? Snowflake doesn't technically have non-
NUMBER
integer types: https://docs.snowflake.net/manuals/sql-reference/data-types-numeric.html#int-integer-bigint-smallint-tinyint-byteint - On the database end,information_schema.columns
reports all these as being DECIMAL(38, 0). I've gone with: everything on snowflake isnumeric
,float
, ortext
and none of it isinteger
.