cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
cancel
Showing results for 
Search instead for 
Did you mean: 

Error when create an external location using code

noimeta
Contributor II

I'm trying to create an external location from notebook, and I got this kind of error

[PARSE_SYNTAX_ERROR] Syntax error at or near 'LOCATION'(line 1, pos 16)
 
== SQL ==
CREATE EXTERNAL LOCATION IF NOT EXISTS test_location URL 's3://test-bronze/db/test_schema/test_table' WITH (STORAGE CREDENTIAL test-credential)
----------------^^^

I tried with DBR10.4, DBR11.1 and DBR11.2, unfortunately, none of them worked.

However, SHOW EXTERNAL LOCATIONS and DESCRIBE EXTERNAL LOCATION *** work just fine.

Also, I can create an external location from the UI without any problem

Anyone knows how to solve this issue?

1 ACCEPTED SOLUTION

Accepted Solutions

Pat
Honored Contributor III

It seems like error is due to '-' in the storage credential name, you need to use backticks `some-name`:

CREATE EXTERNAL LOCATION IF NOT EXISTS test_location URL 's3://test-bronze/db/test_schema/test_table' WITH (STORAGE CREDENTIAL `test-credential`)

thanks,

Patryk.

View solution in original post

17 REPLIES 17

-werners-
Esteemed Contributor III

Seems to be ok at first sight. Do you run it from Databricks SQL ( the SQL persona)?

I tried with both Databricks SQL and notebook, but they outputted the same error.

-werners-
Esteemed Contributor III

can you create an external location from that particular location using the UI?

To exclude that being an issue...

yes, the UI works fine

-werners-
Esteemed Contributor III

Strange. I can't test it myself as I am on Azure.

maybe it is the url you provide? On Azure I also have to define the blob container and storage account:

abfss://<container_name>@<storage_account>.dfs.core.windows.net/<path>

I just imitated the code from an example here https://docs.databricks.com/data-governance/unity-catalog/manage-external-locations-and-credentials.... and it's also the same path when I inputted to the UI. Now, I have no idea why it doesn't work.

Kaniz
Community Manager
Community Manager

Hi @noi metaaphanon​ , We're extremely sorry for the negative experience you're facing with the above example. Can you please help us with filing a support ticket for the same here?

Hi @Kaniz Fatma​ ,

Thank you very much for your response.

I've been trying to submit a case, but it always asks me to sign in.

After I signed in with my Databricks workspace account, it jumped to the community home page. So, I came to this post and clicked your link again, then it asked me to log in again.

Kaniz
Community Manager
Community Manager

Hi @noi metaaphanon​, Thank you for your feedback. Our team shall reach out and help you with the issue you've been facing. Please drop an email at community@databricks.com.

constantins
New Contributor II

I am facing the same problem. Was this resolved? If so, what was the solution?

unfortunately, not yet

Kaniz
Community Manager
Community Manager

Hi @Constantin Sapkidis​ and @noi metaaphanon​, Please drop an email at community@databricks.com.

mguentazdir
New Contributor II

Hi, is there a new status here? Is there a workaround which does not include the GUI? I am using Databricks on Azure and i am running into the same issue.

Thx.

In my case, yes, the problem is solved. Please check the best answer.

Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.