Simplify complex SQL queries with Views in Postgres

Поделиться
HTML-код
  • Опубликовано: 11 июл 2024
  • Writing raw SQL can be extremely powerful, but queries that are joining tables and aggregating data can quickly increase in complexity. In this video, Jon Meyers steps through refactoring an existing application to query Views instead of Tables, greatly simplifying PostgreSQL queries.
    Building an email client with the Next.js App Router and Postgres: • Building an email clie...
    00:00 Simplify complex SQL queries with Views in Postgres
    01:26 Creating a free Supabase project
    03:41 Refactor data fetching logic to use supabase-js
    08:55 Create a PostgreSQL view using Supabase AI
    12:01 Refactoring a complex query with multiple joins to use Postgres Views
    25:47 Perform complex mutations using Postgres Functions and Transactions
    📹 Full Next.js Email Client playlist: • Build an Email Client ...
    🧑‍💻 GitHub repo: github.com/dijonmusters/nextj...
    Introspect PostgreSQL schema and generate TypeScript definitions: • Introspect PostgreSQL ...
    💻 Videos to watch next:
    ▶ Fastest way to host a Postgres database: • FASTEST way to host a ...
    ▶ Implement Authorization using Row Level Security with Supabase: • Implement Authorizatio...
    ▶ Generate column values in Postgres with Functions, Triggers, default values and RLS: • Generate column values...
    👇 Learn more about Supabase 👇
    🕸 Website: supabase.com/
    🏁 Get started: app.supabase.com/
    📄 Docs: supabase.com/docs
    🔔 Subscribe for more tutorials and feature updates from Supabase: / @supabase
    📱 Connect with Us:
    🐙 Github: github.com/supabase
    💬 Discord: discord.supabase.com/
    🐦 Twitter: / supabase
    📸 Instagram (follow for memes): / supabasecom
    ABOUT SUPABASE:
    Supabase is the open source Firebase alternative. Supabase provides a full Postgres database for every project with pgvector, backups, realtime, and more. Add and manage email and password, passwordless, OAuth, and mobile logins to your project through a suite of identity providers and APIs.
    Build in a weekend, scale to millions.
    #Supabase #AppDevelopment #RealtimeApps #DeveloperTools
  • НаукаНаука

Комментарии • 26

  • @canergurelsoy6875
    @canergurelsoy6875 3 месяца назад +7

    I'm just loving supabase more and more everyday . Nice job, pls keep bringing it.

    • @parkerrex
      @parkerrex 3 месяца назад +1

      the videos help a lot

    • @JonMeyers
      @JonMeyers 3 месяца назад

      Glad you enjoyed it! What are you going to build?

    • @JonMeyers
      @JonMeyers 3 месяца назад

      @@parkerrexthanks! 🙌 What would you like to see a video on next?

  • @remi-avec-un-i
    @remi-avec-un-i 3 месяца назад +8

    Views are something I already heard of but never saw in action, thanks J

    • @JonMeyers
      @JonMeyers 3 месяца назад

      Yeah, they are very handy for something so simple to create! Glad you enjoyed the video! 🙌

  • @dshukertjr
    @dshukertjr 3 месяца назад +3

    I didn't know that `returns()` function on the `select()` call existed! That's very handy!

    • @JonMeyers
      @JonMeyers 3 месяца назад +1

      Yeah, I only learnt about it while putting this video together! Very handy!

  • @caseyspaulding
    @caseyspaulding 8 дней назад

    This is supa helpful. Thanks.

  • @VincentFulco
    @VincentFulco 3 месяца назад +1

    Thanks for this example!

    • @JonMeyers
      @JonMeyers 3 месяца назад

      Glad you enjoyed it! Thanks for watching 🙌

  • @Speechrezz
    @Speechrezz 3 месяца назад

    Really helpful video, thank you! I've started using views in my own Supabase project now and it really simplified my queries!

  • @loucasi
    @loucasi 6 дней назад

    Supabase videos in general are very helpful and the content is great , I really think it's time to start making these with an AI on the side bcs at this level of coding I think everyone would be better off learning the prompts we have to send in order to get the code. Tutorials should focus on: this is how you prime the model to be ready for a "Views + RLS on Supabase" conversation and that's how you prompt for each case. Instead of losing time to actually record themselves writing the code it would be much more SCALABLE advice to figure out where the AI model is prone for a mistake and the tutorial showing what to look for or how to avoid it all together. Thoughts?
    Here they do it already a bit with the in-house supabase AI but I tried it and it does make mistakes - which I used Claude 3.5 to fix!

  • @tonyoconnell99
    @tonyoconnell99 3 месяца назад

    I really love this tutorial. i learned so much both yourself and lee. i'm going to use it to replace charbot ui 's frontend (but not their supabase backend) so my users can have conversations with different ai models faster. i would really appreciate a link to a github repo of the code you wrote for supabase. i couldn't find your repo anywhere. if needed i will type the code code from the tuturial and still be happy.

  • @imho7992
    @imho7992 Месяц назад

    Can views also transform POSTGIS geography coordinates back to lat / lng integers?

  • @slavenDj
    @slavenDj 3 месяца назад

    Great videos!
    Is there going to be a video about encryption. Example i have not read anywhere that when i add security label via sql editor to a column it automatically creates trigger and views for decryption

  • @user-vd3ph6zh8q
    @user-vd3ph6zh8q 2 месяца назад

    Is it better to create a client for each function call over exporting a global constant of the client instance?
    Like `export const supabase = createClient(SUPABASE_URL, SUPABASE_ANON_KEY);`

  • @LM43243
    @LM43243 3 месяца назад

    As somebody here in the comments mentioned, please do a video on encrypting data! Can't seem to figure out how to do it with next / supabase for my db.

  • @hawarhekmat1174
    @hawarhekmat1174 3 месяца назад

    Sign in with Google using server action with a client button won't work, when I log the data it gives back a url but in browser won't redirect to Google sign in page but in vscode console when I click on the url it does, maybe it's because of new Google sign in thing.

    • @twisterrjl
      @twisterrjl 3 месяца назад

      Have you also changed the link in supa > auth > url configuration? I sometimes forget to do that

  • @rohan7011
    @rohan7011 3 месяца назад +1

    Where is the original video link?

    • @JonMeyers
      @JonMeyers 3 месяца назад

      You mean for Lee’s version? Will add it to the description! Thanks for the reminder!

    • @tonyoconnell99
      @tonyoconnell99 3 месяца назад

      @@JonMeyers Here's another reminder. I can't wait to use it. It's such a wonderful example of what Supabase can do. The code and design of the email client's is beautifully simple, and your database is simple and succint. There is nothing faster. Thanks for making this and for teaching me how to do it.

  • @rtorcato
    @rtorcato 3 месяца назад

    drizzle has support for views and coming soon foreign table support too, which is great for migrations.. Does Supabase use drizzle?

  • @Alex-bc3xe
    @Alex-bc3xe 2 месяца назад

    Hmm I then see no reason to use an ORM cause supabase has pretty easy synthax

  • @Laflamablanca969
    @Laflamablanca969 3 месяца назад +1

    You are very enthusiastic… way too enthusiastic lol. Chill bruz