-
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
RPC server sometimes returns the wrong type #2984
Comments
Thanks for this reproduction case @aaronraff! I have an even simpler one: select '0000000025'::varchar as my_varchar_column base64 encoded: "table": {
"column_names": [
"my_varchar_column"
],
"rows": [
[
25.0
]
]
} I think the issue here is with how the RPC server handles data types implicitly, rather than storing them explicitly alongside JSON results. |
This is definitely an issue with agate. I dived a bit deeper into the example from above. The method that switches this from a padded string to an integer is Here's the simple reproduction case: >>> import dbt.clients.agate_helper
>>> data = [{'my_varchar_column': '0000000025'}]
>>> column_names = ['my_varchar_column']
>>> agate_tbl = dbt.clients.agate_helper.table_from_data_flat(
... data,
... column_names
... )
>>> agate_tbl.print_table()
| my_varchar_column |
| ----------------- |
| 25 | Agate does a lot of type inference under the hood. We enable user-supplied column type overrides for seeds, but I don't think that makes a lot of sense for one-off RPC queries. Really, we should be getting the data type from the database, though that may mean handling some low-level differences across cursors. Here's what
Versus Snowflake:
Whereas other databases, e.g. BigQuery, reimplement |
automatic commit by git-black, original commits: 1ad1c83
Describe the bug
While using the RPC server, some values are returned as the wrong type. It looks like strings are being cast to floats somehow.
Steps To Reproduce
dbt rpc
)The SQL here is the base64 encoded version of:
request_token
from the responsepad_int_varchar
is padded since it is represented as a varchar, and not an integerExpected behavior
I would expect that all of the rows returned would be strings (since they were casted), and not floats. As seen in step 5, the second to last row is not padded since it is being represented as a float.
Screenshots and log output
I don't have any other relevant logs or output, but I'm happy to add more of the RPC response to this issue if that is helpful!
System information
Which database are you using dbt with?
The output of
dbt --version
:The operating system you're using:
macOS Catalina
Version 10.15.7
The output of
python --version
:Python 3.7.7
Additional context
N/A
The text was updated successfully, but these errors were encountered: