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

PG: Only list tables where schema has USAGE permission #7000

Merged
merged 1 commit into from
Jun 6, 2024

Conversation

eradman
Copy link
Collaborator

@eradman eradman commented Jun 5, 2024

What type of PR is this?

  • Refactor
  • Feature
  • Bug Fix
  • New Query Runner (Data Source)
  • New Alert Destination
  • Other

Description

This covers cases where partitioned tables are part of a schema that is not accessible by the current user.

How is this tested?

  • Unit tests (pytest, jest)
  • E2E Tests (Cypress)
  • Manually
  • N/A

Create a new schema then set up a data source for Redash with another, non-superuser role

CREATE SCHEMA xyz;

CREATE TABLE xyz.tab (
   id bigint GENERATED ALWAYS AS IDENTITY,
   ts timestamp NOT NULL
) PARTITION BY LIST ((ts::date));

CREATE TABLE xyz.tab_default PARTITION OF xyz.tab DEFAULT;

Related Tickets & Documents

#6988

This covers cases where partitioned tables are part of a schema that is
not accessible by the current user.

CREATE SCHEMA xyz;

CREATE TABLE xyz.tab (
   id bigint GENERATED ALWAYS AS IDENTITY,
   ts timestamp NOT NULL
) PARTITION BY LIST ((ts::date));

CREATE TABLE xyz.tab_default PARTITION OF xyz.tab DEFAULT;
Copy link

codecov bot commented Jun 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 63.74%. Comparing base (10a46fd) to head (c8fb833).
Report is 6 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7000      +/-   ##
==========================================
- Coverage   63.85%   63.74%   -0.11%     
==========================================
  Files         161      162       +1     
  Lines       13082    13222     +140     
  Branches     1811     1866      +55     
==========================================
+ Hits         8353     8428      +75     
- Misses       4429     4474      +45     
- Partials      300      320      +20     
Files Coverage Δ
redash/query_runner/pg.py 42.34% <ø> (-0.22%) ⬇️

... and 9 files with indirect coverage changes

Copy link
Member

@justinclift justinclift left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eyeballing this, it makes good sense to me. 😄

@justinclift justinclift merged commit 17fe69f into getredash:master Jun 6, 2024
12 of 13 checks passed
@eradman eradman deleted the pg-schema branch June 6, 2024 01:11
@eradman
Copy link
Collaborator Author

eradman commented Jun 6, 2024

Thanks @justinclift for the second set of eyeballs! Could not figure out how to write a meaningful test for this, so had to rely on manual testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants