wpix
wpix

Reputation: 1

Only able to get specific columns with Supabase and Next.js

I'm only able to fetch certain columns out of my database. I'd like to get every row out of my table, but when I select all, nothing is returned. My table (shows) has 9 columns. I just created the table so there is only one row of data.

Here is example of code that works:

const supabase = createClient(process.env.NEXT_PUBLIC_SUPABASE_URL, process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY);


let { data: shows, error } = await supabase.from('shows').select('city')
console.log(shows);

This logs [ { city: 'Denver' } ]

However, if I try to query all rows as per the Supabase documentation:

let { data: shows, error } = await supabase.from('shows').select()
console.log(shows);

It logs an empty array. Some documentation states I should put '*' in the select method, but that doesn't do anythin either. How can I get my data row by row with data from every column? I'm wanting to iterate over each row and display some information about each show.

Upvotes: 0

Views: 840

Answers (1)

Stackgik
Stackgik

Reputation: 1

I ran into the same issue. In my case, using select(' ') instead of select(*) solved the problem.

Upvotes: 0

Related Questions