Why won’t DataGrip let me query a table?

  Kiến thức lập trình

I can create or delete a table in VSCode like so:

def write_to_RS(query):
    try:
        secret_arn = session.client('secretsmanager').get_secret_value(SecretId=rs_secret_id)['ARN']

        # Initializing Redshift client
        logger.info("Initializing Redshift's client ...")
        config = Config(connect_timeout=180, read_timeout=180)
        client_redshift = session.client("redshift-data", config=config)

        client_redshift.execute_statement(Database=db,
                                          SecretArn=secret_arn,
                                          Sql=query,
                                          ClusterIdentifier=cluster_id)
        
        permissions_update = "GRANT ALL ON ALL TABLES IN SCHEMA my_schema TO GROUP admin"
        
        client_redshift.execute_statement(Database=db,
                                    SecretArn=secret_arn,
                                    Sql=permissions_update,
                                    ClusterIdentifier=cluster_id)
    except Exception as e:
        raise Exception(e)

q = """
CREATE TABLE IF NOT EXISTS address (
    account_id INT,
    street VARCHAR,
    city VARCHAR,
    country VARCHAR
)
"""

write_to_RS(q)

# write_to_RS('DROP TABLE address')

but when i try to open it or query it in DataGrip directly, it throws an error:
[42501] ERROR: permission denied for relation address

Why it be like that 😐

LEAVE A COMMENT