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: 

remote_query() is not working

vr
Contributor III

I am trying to experiment with remote_query() function according to the documentation. The feature is in public preview, so I assume it should be available to everyone now.

select * from remote_query(
  'my_connection',
  database => 'mydb',
  dbtable => 'my_table'
  )

Whenever I query, I am getting one of two errors:

[INVALID_USAGE_OF_STAR_OR_REGEX] Invalid usage of '*' in Project. SQLSTATE: 42000
== SQL (line 2, position 8) ==
select * from remote_query(
       ^

If I change `*` to a column name, say, `id`, I get the following:

[UNRESOLVED_COLUMN.WITHOUT_SUGGESTION] A column, variable, or function parameter with name `id` cannot be resolved.  SQLSTATE: 42703
== SQL (line 2, position 8) ==
select id from remote_query(
       ^^

All prerequisites are satisfied: connection is live, which is confirmed by a Lakehouse Federation catalog built on top of the same connection. Runtime is 17.3 RTS, have USE CONNECTION (I am also the owner).

Can anyone please explain what I am doing wrong?

17 REPLIES 17

vr
Contributor III

You was right, I did not realize we have the Previews page for such settings. My colleague enabled it and now it works!

Thank you, dear community.

GA4
New Contributor

Hi @Coffee77 are you giving the foreign catalog details in the remote query function? coffee77.sampleDB

Coffee77
Contributor III

My SQL database was called "Coffee77.SampleDB". Maybe not the best name indeed, removing "." from it would have been better! Is due to that you confusion/ question?


Lifelong Solution Architect Learner | Coffee & Data

Join Us as a Local Community Builder!

Passionate about hosting events and connecting people? Help us grow a vibrant local community—sign up today to get started!

Sign Up Now