cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Lakebase Synced Tables Failing Initial Load Due to Missing CONNECT Privilege on Writer Role

kendel64jen
New Contributor

I'm investigating an issue with Azure Databricks Lakebase Autoscaling where synced tables are successfully created in Unity Catalog through Terraform, but their initial pipeline loads consistently fail.

The issue was eventually traced to a missing CONNECT privilege on the database-specific databricks_writer_<dbid> role.

Despite the database being created successfully through the Lakebase UI, its ACL showed that the writer role had CREATE but not CONNECT. Both reader roles had the expected CONNECT privilege.

Interestingly, recreating the synced tables under different creator identities made no difference. Both identities already had the necessary database permissions, confirming that the problem was not related to the creator's privileges.

The actual error was buried in the pipeline events:

ERROR: permission denied for database "<mydb>"

The fix was straightforward:

GRANT CONNECT ON DATABASE <mydb> TO databricks_writer_<oid>;

After applying this grant as a member of databricks_superuser, all three pipelines completed successfully on their next trigger, and the resulting row counts matched the source tables exactly. No other configuration changes were required.

I'd appreciate clarification from the Databricks team and anyone who has encountered similar behaviour:

Is it expected for a UI-created Lakebase database to provision its own writer role with CREATE but without CONNECT, or does this point to a provisioning bug?

Is manually granting CONNECT to the database-specific writer role an officially supported fix, or should another provisioning or initialization step have handled this automatically?

Should checking the writer role's database privileges be part of the standard readiness checks before configuring synced tables, especially for older databases?

Is there a supported API or diagnostic method to verify these permissions without directly querying pg_database.datacl?

One concern is that Databricks documentation warns against modifying system roles because doing so may affect instance behaviour. I'd prefer to understand whether this grant is safe and supported long-term rather than maintain an undocumented workaround.

Environment:

Azure Databricks

Lakebase Autoscaling

Terraform Databricks provider 1.122.0

Resource: databricks_postgres_synced_table

scheduling_policy = TRIGGERED

create_database_objects_if_missing = true

Initial status: SYNCED_TABLE_OFFLINE_FAILED

 

1 REPLY 1

arthurfr23
New Contributor III

Before you open a ticket, check one thing. In Postgres, CONNECT is granted to PUBLIC by default. If someone ran REVOKE CONNECT ON DATABASE ... FROM PUBLIC as a hardening step, the writer may have been relying on that PUBLIC grant, while the readers have their own explicit grant. In that case, nothing went wrong during provisioning.

You don't need to read datacl directly. These are standard Postgres checks:

SELECT r.rolname,
       has_database_privilege(r.rolname, current_database(), 'CONNECT') AS can_connect,
       has_database_privilege(r.rolname, current_database(), 'CREATE')  AS can_create
FROM pg_roles r
WHERE r.rolname LIKE 'databricks_writer_%' OR r.rolname LIKE 'databricks_reader_%';

As far as I know, there's no Databricks API that exposes this. I'd add the query to the readiness checks you run before creating synced tables in Terraform.

Is the grant safe long-term? The docs say these system roles are assigned the minimum privileges required for functionality. Modifying them can impact instance behavior. I couldn't find any page that lists a manual GRANT CONNECT as a supported fix. Adding CONNECT is a small change, since the role clearly needs it. Still, I'd keep the grant in place and open a support ticket with the database ID so Databricks can confirm or fix the provisioning.

Arthur Ferreira Reis