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

[BUG] Problem create table with row access policy #47

Closed
imartynetz opened this issue Oct 29, 2021 · 1 comment · Fixed by #48
Closed

[BUG] Problem create table with row access policy #47

imartynetz opened this issue Oct 29, 2021 · 1 comment · Fixed by #48
Labels
bug Something isn't working good_first_issue Good for newcomers

Comments

@imartynetz
Copy link
Contributor

Describe the bug

I create a row policy level in bigquery for the user who is used in dbt to access it, and when I try to run dbt run -m + dim_table the tables that is created using reference of the table with row access policy got a macro error. I got the run target for that table, and running directly on bigquery everything works fine.
I trying to use this process to add the dbt user in row policy access to spread more easily on others tables this row I don't want to show in Metabase.

Steps To Reproduce

Create a row access policy using

CREATE OR REPLACE ROW ACCESS POLICY teste
ON `tableA`
GRANT TO ("serviceAccount:dbt_service_account@project_id.iam.gserviceaccount.com")
FILTER USING (id != "99");

Where service account is the same used previous in dbt to access.

then create a sql file with

select
    *
from
    {{ ref('tableA') }}

Without row access policy evething works fine, with row access policy i got and error

Expected behavior

Expect the table be created and in table a when try to get information from id 99 will return an empty result
But instead i got and error

Screenshots and log output

Completed with 1 error and 0 warnings:

Compilation Error in macro statement (macros/core.sql)
  bad operand type for abs(): 'NoneType'
  
  > in macro materialization_table_bigquery (macros/materializations/table.sql)
  > called by macro statement (macros/core.sql)

Done. PASS=8 WARN=0 ERROR=1 SKIP=1 TOTAL=10

System information

I try in both

installed version: 0.19.1

Plugins:
  - redshift: 0.19.1
  - postgres: 0.19.1
  - bigquery: 0.19.1
  - snowflake: 0.19.1

and in

installed version: 0.21.0

Plugins:
  - redshift: 0.21.0
  - postgres: 0.21.0
  - bigquery: 0.21.0
  - snowflake: 0.21.0

The operating system you're using:
debian buster
The output of python --version:
python 3.8

Additional context

Add any other context about the problem here.

@jtcohen6
Copy link
Contributor

jtcohen6 commented Nov 3, 2021

@imartynetz This really had me stumped! Thanks for opening the bug, finding the cause, and opening the PR to fix it. I'll leave comments over there.

@jtcohen6 jtcohen6 added good_first_issue Good for newcomers and removed triage labels Nov 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good_first_issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants