Add examples for new way to access database
Hbbb opened this issue · comments
Improve documentation
I'm a new user of supabase-swift, and relatively new to Swift as well so apologies if any of this is obvious.
I am seeing a deprecation warning when doing something like this
await supabase.database.from("users")
'database' is deprecated: Direct access to database is deprecated, please use one of the available methods such as, SupabaseClient.from(_:), SupabaseClient.rpc(_:params:), or SupabaseClient.schema(_:).
I grabbed this code from the Supabase website. All of the examples suggest doing DB queries like this. I can't find any examples of this new method.
Link
https://supabase.com/docs/reference/swift/initializing
All of the examples on this page showcase DB access like supabase.database.from()
.
Describe the problem
The documentation is missing examples for the new way to interact with the Database. I notice there is a PR #341 that removes this method. Unfortunately I can't find examples of the new style of doing queries. I'm concerned that if this PR gets merged before the documentation is published, others like myself will be stuck on older versions of the lib until we figure out how to migrate our code.
Describe the improvement
Please update the Swift lib reference page with modern examples of how to run queries with the Supabase client.
Additional context
As a Swift/iOS beginner, it's hard to infer from the deprecation warnings what the correct way to use the library is. I depend on examples a lot, especially given how little I know the language. This may just be a me problem, but I imagine there are a lot of other beginners using this to build iOS apps.
Hi @Hbbb thank you for pointing out the wrong docs.
For this specific case, you just need to drop the .database
and use the method directly in supabase
, for example:
Instead of await supabase.database.from("users")
, use await supabase.from("users")
. The same applies for rpc
and schema
calls.
Hope this made things a bit more clear to you.
I'll update docs too, thanks you.
@grdsdev Thank you so much! 👍