user2224893
user2224893

Reputation: 149

In supabase-js how to display corresponding SQL query in console.log?

I want this

const { data, error } = await supabase
        .from('users')
        .select(`*`)
        .eq('id', 5)
        .single();

to print out this

SELECT * FROM users WHERE id=5

in console.

or atleast where can i find it in the supabase dashboard logs

Upvotes: 0

Views: 387

Answers (1)

Andrew Smith
Andrew Smith

Reputation: 1841

The query will not look like that. PostgREST will write a CTE query for most of these. The syntax you have from the SDK isn't directly related to SQL, it's a Rest API url builder. If you want to see the query you can look in your Postgres logs inside the Supabase dashboard. Supabase also has a tool for converting SQL to the REST API https://supabase.com/docs/guides/api/sql-to-rest, however they don't have a tool that does the opposite.

Upvotes: 1

Related Questions