1

I would like to create this row level security in Python. It is a row level security we are able to create in Google Cloud Platform through Bigquert but I would like to create it directly from a python script through possible API. Someone has experiences with that process?


    CREATE OR REPLACE ROW ACCESS POLICY test
    ON `chrome-coast-332.Test`
    GRANT TO ("user:user@gmail.com")
    FILTER USING (gender = "F");
Cooper
  • 59,616
  • 6
  • 23
  • 54
  • Are you using a specific library on python? Are you passing any credentials on your code? – Jose Gutierrez Paliza Nov 05 '21 at 23:04
  • Run a query on BigQuery! What's your concern? – guillaume blaquiere Nov 06 '21 at 14:35
  • @JoseGutierrezPaliza I am using pandas-gbq and yeah I am using the project ID stored in Google Cloud Plaftorm. I am able to use basic sql codes such as select XXX from Table A. But to create a policy to restrict the access is more difficult. – Filipe Wolfrum caeiros Nov 08 '21 at 08:47
  • @guillaumeblaquiere Yes but we try to do that via a python script for the purpose of the work – Filipe Wolfrum caeiros Nov 08 '21 at 08:47
  • Run a query with the BigQuery client library in your script. What is the problem with that? – guillaume blaquiere Nov 08 '21 at 12:37
  • I recommend you to use BigQuery API Client Libraries[1]. Or one thing that can help you is that if you cannot run it from the script it can be the user credential[2] that you are using in your project so you create a new credential that grants access to the row level policy. [1]https://cloud.google.com/bigquery/docs/reference/libraries#installing_the_client_library [2]https://cloud.google.com/docs/authentication/production#create_service_account – Jose Gutierrez Paliza Nov 08 '21 at 21:26

0 Answers0