I'm having trouble inserting into a table
# javascript
m
I'm having trouble inserting into a table
s
Please be more descriptive with your issue as this isn't very helpful for someone to be able to assist you
m
yeah sorry i was gonna type more lol
s
For future reference, type everything in one message before hitting enter
m
essentially im trying to take course data from an api and insert it into a supabase table. I don't get any errors in my code but nothing gets inserted into the table
s
btw I know how frustrating it can be when you hit a wall/error, but try to just take a little time and write out your thoughts before hitting enter.
m
no problem, will do next time
s
Can you provide an example of the code you are using? also do you have row level security (RLS) turned on on your table?
m
and yes I did enable row level security
s
If you are inserting a single entry you don't need the an array with an object, just pass the object to the insert function
m
ok
and btw for row level security all I did was enable it on this table in the GUI. I didn't write anything for it in the SQL query to make the table
s
Ah you will need to write a rule to allow insert then
That is what is causing the data from inserting
m
ahhh
What is the easiest way to do this?
s
It depends on what you want RLS for, is it to make sure only logged in users can add data?
m
I'll want users to be able to modify their "profile" at some point but right now my "course" table is just to take data from the API and insert all of it in. This table will be static after everything is inserted
s
Just turn off RLS for it then if you are using it now while in development
m
ok
I guess I'll worry about RLS later on then. Thanks!
s
Yeah if you are only inserting course data while in development, you can turn on RLS after and don't add a policy for INSERT but you will need to add one for SELECT.
m
gotcha... I'll definitely want any user to be able to SELECT data from the course table