-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
fix(batch-exports): Try to handle missing Postgres permissions #27437
Conversation
await internal_logger.awarning( | ||
"Insufficient privileges to get table columns for table '%s.%s'; will assume all columns are present", | ||
schema=inputs.schema, | ||
table_name=inputs.table_name, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could probably make this a public log if we indicate users how to resolve this:
- Grant us permissions.
- Ensure table is updated to latest schema.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah that's a good idea, thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
have updated
schema=inputs.schema, | ||
table_name=inputs.table_name, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't these two be positional parameters if we are using the formatting %s?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
>>> logger.info("%s.%s", schema="test", table="test")
2025-01-10 14:33:10 [info ] %s.%s schema=test table=test
>>> logger.info("%s.%s", "test", "test")
2025-01-10 14:33:21 [info ] test.test
I assume we expect the second result.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah yes, sorry, my bad
"Insufficient privileges to get table columns for table '%s.%s'; " | ||
"will assume all columns are present. If this results in an error, please grant SELECT " | ||
"permissions on this table or ensure the destination table is using the latest schema " | ||
"as described in the docs.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we link the docs here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point, have added now 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Thank you!
Problem
We try to fetch a list of columns for the destination table in case it doesn't contain all the columns present in the record batch. However this can sometimes fail with permissions errors if we don't have
SELECT
permissions on the destination table.Changes
Catch permissions errors and assume all columns are present. Note that this means existing batch exports could still fail during the merge if the destination table is missing columns present in the record batch.
👉 Stay up-to-date with PostHog coding conventions for a smoother review.
Does this work well for both Cloud and self-hosted?
Yes
How did you test this code?
Existing tests