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

Add examples for new way to access database #389

Closed
Hbbb opened this issue May 16, 2024 · 2 comments · Fixed by supabase/supabase#26439
Closed

Add examples for new way to access database #389

Hbbb opened this issue May 16, 2024 · 2 comments · Fixed by supabase/supabase#26439
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@Hbbb
Copy link

Hbbb commented May 16, 2024

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.

@Hbbb Hbbb added the documentation Improvements or additions to documentation label May 16, 2024
@grdsdev
Copy link
Collaborator

grdsdev commented May 17, 2024

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.

@Hbbb
Copy link
Author

Hbbb commented May 17, 2024

@grdsdev Thank you so much! 👍

@grdsdev grdsdev self-assigned this May 17, 2024
@grdsdev grdsdev closed this as completed May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants