Skip to content

Add option to grant public read access on Chronon-created tables - #1152

Open
gsarthakdev wants to merge 2 commits into
airbnb:mainfrom
gsarthakdev:grant-public-access-on-table-creation
Open

Add option to grant public read access on Chronon-created tables#1152
gsarthakdev wants to merge 2 commits into
airbnb:mainfrom
gsarthakdev:grant-public-access-on-table-creation

Conversation

@gsarthakdev

@gsarthakdev gsarthakdev commented Sep 11, 2026

Copy link
Copy Markdown

Chronon-created tables default to permissions restricted to the creating service account, so other consumers (notebooks, dashboards, downstream jobs) can't read them without a manual grant.

Add a grantPublicAccess config option to TableUtils, invoked right after table creation, that issues a GRANT SELECT to a configurable role.

Summary

TableUtils creates tables in two places, insertPartitions and insertUnPartitioned, via createTableSql + sql(...). Neither path grants any access beyond the creator.

This PR adds:

  • spark.chronon.table_write.grant_public_access (default false) - enables the grant
  • spark.chronon.table_write.grant_public_access.role (default PUBLIC) - the role to grant SELECT to
  • TableUtils.grantPublicAccess(tableName), called right after table creation in both insertPartitions and insertUnPartitioned when the flag is enabled

A failed grant is caught and logged as a warning rather than propagated, so it can't block table creation or writes - same non-critical-failure pattern as alterTableProperties.

Why / Goal

Filed and scoped in #1033. @pengyu-hou confirmed the use case and suggested this approach (grantPublicAccess, modeled on alterTableProperties) there; this PR implements it as discussed.

Test Plan

  • Added unit tests (TableUtilsTest.testGrantPublicAccessDisabledByDefault, TableUtilsTest.testGrantPublicAccessDoesNotBlockTableCreation)
  • Covered by existing CI

Closes #1033

Introduces spark.chronon.table_write.grant_public_access (default false) and
spark.chronon.table_write.grant_public_access.role (default PUBLIC). When
enabled, TableUtils issues a GRANT SELECT right after a table is created via
insertPartitions or insertUnPartitioned, so consumers (notebooks, dashboards,
downstream jobs) can read Chronon-created tables without a manual grant. A
failed grant is logged and does not block table creation, same as the
alterTableProperties pattern this mirrors.

Closes airbnb#1033
…second one

Spark's session builder merges new config into any already-active session in
the JVM, so building a second SparkSession with grant_public_access=true in
testGrantPublicAccessDoesNotBlockTableCreation was leaking that flag onto the
shared session used across the rest of TableUtilsTest, causing
testGrantPublicAccessDisabledByDefault to fail when run after it in the same
JVM (as CI does). Set/reset the conf on the shared session instead.
@gsarthakdev

Copy link
Copy Markdown
Author

@pengyu-hou Thank you again for scoping this out on #1033. I've implemented the grantPublicAccess approach you suggested there (mirroring alterTableProperties), and CI is passing. Marking this ready for review, let me know if you'd like anything adjusted.

@gsarthakdev
gsarthakdev marked this pull request as ready for review September 11, 2026 02:50
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.

Option to Grant Read Access on Chronon-Created Tables

1 participant