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:ย 

[Question]: Get permissions for a schema containing backticks via the API

seapen
New Contributor II

I am unsure if this is specific to the Java SDK, but i am having issues checking effective permissions on the following schema:

 
databricks_dev.test_schema`

In Scala i have the following example test:

  test("attempting to access schema with backtick") {
    val client = new WorkspaceClient()
    client.config().setHost("redacted").setToken("redacted")

    val result = client.grants().getEffective(
        new GetEffectiveRequest()
          .setFullName("databricks_dev.test_schema`")
          .setPrincipal("redacted")
          .setSecurableType(SecurableType.SCHEMA)
      )
    .getPrivilegeAssignments
    println(result)
  }

But this fails with:

 Illegal character in path at index 124: https://dbc-xxxxx-xxx.cloud.databricks.com/api/2.1/unity-catalog/effective-permissions/SCHEMA/databricks_dev.test_schema`

- If i rename the schema and remove the back-tick, this works fine.

- I have also tried encoding the backtick as %60 and i get the same error as above

- i have tried wrapping the schema in backticks and escaping the backtick but still get the same error

1 REPLY 1

seapen
New Contributor II

Update:

Interestingly, if i URL encode _twice_ it appears to work, eg:

  test("attempting to access schema with backtick") {
    val client = new WorkspaceClient()
    client.config().setHost("redacted").setToken("redacted")

    val name = "databricks_dev.test_schema`"
    val encoded = URLEncoder.encode(name, "UTF-8")
    val encodedAgain = URLEncoder.encode(encoded, "UTF-8")

    val result = client.grants().getEffective(
        new GetEffectiveRequest()
          .setFullName(encodedAgain)
          .setPrincipal("redacted")
          .setSecurableType(SecurableType.SCHEMA)
      )
      .getPrivilegeAssignments
    println(result)
  }

So:

  • "databricks_dev.test_schema`" does not work
  • "databricks_dev.test_schema%60" does not work
  • "databricks_dev.test_schema%2560" DOES work

I am assuming i am doing something wrong here as this behavior does appear strange.