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

run_sql command via dbt rpc returns Object of type Decimal is not JSON serializable #2336

Closed
1 of 5 tasks
brettgriffin opened this issue Apr 16, 2020 · 1 comment · Fixed by #2348
Closed
1 of 5 tasks
Labels
bigquery bug Something isn't working

Comments

@brettgriffin
Copy link

Describe the bug

Executing a run_sql command via dbt rbc against a BigQuery profile returns Object of type Decimal is not JSON serializable. The equivalent command against Redshift, Snowflake, and PostgreSQL connections works correctly.

Steps To Reproduce

A model exists with the body with source as ( select * from {{source('recharge', 'orders')}} ) select * from source.

The query of the model is wrapped in a CTE limiting its results to 100 records:

with run_cte as (with source as ( select * from {{source('recharge', 'orders')}} )) select * from run_cte limit 100

And converted to base64:

d2l0aCBydW5fY3RlIGFzICh3aXRoIHNvdXJjZSBhcyAoIHNlbGVjdCAqIGZyb20ge3tzb3VyY2UoJ3JlY2hhcmdlJywgJ29yZGVycycpfX0gKSkgc2VsZWN0ICogZnJvbSBydW5fY3RlIGxpbWl0IDEwMA==

A request is made to the RPC Server with the run_sql command, with the following body:

{
    jsonrpc: "2.0",
    method: 'run_sql',
    id: 123,
    params:  {
      name: "query",
      timeout: 60,
      sql: d2l0aCBydW5fY3RlIGFzICh3aXRoIHNvdXJjZSBhcyAoIHNlbGVjdCAqIGZyb20ge3tzb3VyY2UoJ3JlY2hhcmdlJywgJ29yZGVycycpfX0gKSkgc2VsZWN0ICogZnJvbSBydW5fY3RlIGxpbWl0IDEwMA==
    }

Expected behavior

I would expect this to return the result set of the underlying sql statement.

Screenshots and log output

If applicable, add screenshots or log output to help explain your problem.

System information

Which database are you using dbt with?

  • postgres
  • redshift
  • bigquery
  • snowflake
  • other (specify: ____________)

The output of dbt --version:

0.16.01

The operating system you're using: macOS 10.13.6

The output of python --version: 3.7

Additional context

Add any other context about the problem here.

@brettgriffin brettgriffin added bug Something isn't working triage labels Apr 16, 2020
@drewbanin drewbanin changed the title run_sql command via rbt rpc returns Object of type Decimal is not JSON serializable run_sql command via dbt rpc returns Object of type Decimal is not JSON serializable Apr 20, 2020
@drewbanin drewbanin added bigquery and removed triage labels Apr 21, 2020
@drewbanin
Copy link
Contributor

Thanks for the report @brettgriffin - this error occurs if a numeric column is found inside of a struct or array column in BigQuery

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bigquery bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants