Can't retrieve select() after insert()
Describe the bug As per documentation (of the other official APIs), we should be calling .select() after an insert() to retrieve the inserted row's id. Unfortunately, .select() does not exist on SyncQueryRequestBuilder, and simply calling insert does not return the inserted row.
To Reproduce supabase.table("Test").insert(vars(test)).select('id').execute() AttributeError: 'SyncQueryRequestBuilder' object has no attribute 'select'
Expected behavior The id is returned.
Desktop:
- Python 3.9
- Supabase-py 1.0.2
Data is returned anyway from execute. Data is based on the returning param of insert, but defaults to full representation.
resp = supabase.table("table").insert(data, upsert=True).execute()
obj = resp.data[0] # full json object of row
You can change returning to "minimal," though I haven't tested it so not sure if it gives you only a primary key or not.
Tried setting returning to "minimal" and it just returned an empty list, even though the rows get inserted.
The documentation has since been updated. You don't call .select() after .insert() for the Python library. We will probably change to follow the JavaScript library in the next major version release.