Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inserting a row to a table does not work #1030

Open
franklili3 opened this issue Jan 20, 2025 · 2 comments
Open

Inserting a row to a table does not work #1030

franklili3 opened this issue Jan 20, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@franklili3
Copy link

Bug report

  • [ *] I confirm this is a bug with Supabase, not with my own application.
  • [* ] I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

When I insert a row to a table, the response 'data' is empty, it does not work.

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. create a table 'test3'
  2. Enable RLS
  3. Add 'Enable insert for authenticated users only' Policy
  4. Add user in ROLE
  5. create python 3.10 virture envionment
  6. add .env file and add envionment viable
  7. run insert_test.py
    please see this repo supabase-py-test.

Expected behavior

A row will be inserted in 'test3' table.

Screenshots

Image
Image
Image

System information

  • OS: [ Windows]

  • Version of supabase-py: [2.11.0]

  • Version of Python: [3.10.0]

Additional context

(p310) C:\myprojects\github\supabase-py-test>python insert_test.py
row_json:  {"accumulated_blocks": 879707}
Traceback (most recent call last):
  File "C:\myprojects\github\supabase-py-test\insert_test.py", line 38, in <module>
    raise Exception(f"Failed to post data: {response3_json}")
Exception: Failed to post data: {'data': [], 'count': None}
```.
@franklili3 franklili3 added the bug Something isn't working label Jan 20, 2025
@silentworks
Copy link
Contributor

You need a select policy in order for any data to be returned.

@silentworks
Copy link
Contributor

I've created a fully working example in the repo linked below to show this in action.

https://github.com/silentworks/sb-python-issues/tree/main/supabase_py_1030

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants