Save Pandas Dataframes and CSVs directly to PostgreSQL Database (Must Know Skill in Data Fields)

แชร์
ฝัง
  • เผยแพร่เมื่อ 5 ก.ย. 2024
  • In this #automation #tutorial you will learn how to save Pandas #dataframes directly to PostgreSQL using one line of code. You will also how to retrieve data from PostgreSQL and loaded directly to a pandas dataframe.
    The python packages used are #pandas #psycopg2, and #sqlalchemy .
    Blog and Code:
    github.com/ami...
    Note: I deleted the database I used in this example. The credentials used won't work.
    #like & #subscribe
    Thanks you For Watching.

ความคิดเห็น • 33

  • @aravinda6563
    @aravinda6563 ปีที่แล้ว +3

    continue posting these kinds of videos 👍👍👍

  • @Pasdpawn
    @Pasdpawn ปีที่แล้ว +1

    thanks for the effort brother. Trying to land a data engineering job. Developing a portfolio with some ETL pipeline projects. Currently working on spotify api pipeline.

  • @veenavipeesh143
    @veenavipeesh143 6 หลายเดือนก่อน

    The best explanation. Thanks for the video

  • @nataliachernysheva7780
    @nataliachernysheva7780 9 หลายเดือนก่อน

    The best explanation I could find, thank you!

  • @Promptcomputing
    @Promptcomputing 10 หลายเดือนก่อน

    Loved this tutorial. Thank you! Followed you on github and youtube.

    • @AminBoutarfi
      @AminBoutarfi  10 หลายเดือนก่อน

      Thank you! Appreciate the support!

  • @boutarfimanel2893
    @boutarfimanel2893 ปีที่แล้ว +1

    Great 😃 thank you 😊

  • @omarosefau3811
    @omarosefau3811 ปีที่แล้ว +1

    Fantastic tutorial, thank you Amin!

    • @AminBoutarfi
      @AminBoutarfi  ปีที่แล้ว

      Thank you for the support 🙏 Subscribe for more!

  • @dobrinyanicitich7514
    @dobrinyanicitich7514 ปีที่แล้ว +1

    Thanks, very good!!!

  • @alejandrofidececchi3284
    @alejandrofidececchi3284 ปีที่แล้ว

    Excellent tutorial! It was very helpful!

  • @jamesbrown6591
    @jamesbrown6591 ปีที่แล้ว

    Excellent tutorial, thank you sir!

  • @user-gh4zy8gu6q
    @user-gh4zy8gu6q ปีที่แล้ว

    Thanks you very much, especially for so clear explanations. Have a nice day!

    • @AminBoutarfi
      @AminBoutarfi  ปีที่แล้ว

      Thank you for the support! Glad you found it useful!

  • @useruserrrrrrr
    @useruserrrrrrr ปีที่แล้ว

    Great video

  • @wheel0513
    @wheel0513 7 หลายเดือนก่อน

    gracias!!! great video. super useful and direct

  • @juancespedes3141
    @juancespedes3141 หลายเดือนก่อน

    Loved this tutorial, really enjoy the way you explain from scratch. But when i try to append the data, i get this error: "UnicodeDecodeError: 'utf-8' codec can't decode byte 0xfa in position 192: invalid start byte", I've been trying to automate the proccess of saving CSVs on a postgres database, specifically a Supabase hosted database, but cant manage to get over this error no matter what i do. I was wondering if maybe you went through this error at some point, if so I'd be gratefull if you helped me with this. For context, I am in colombia rn if that affects the encoding somehow

  • @mehmetkaya4330
    @mehmetkaya4330 ปีที่แล้ว

    Great tutorial!! Thank you so much!!

  • @yosepinpakpahan1168
    @yosepinpakpahan1168 ปีที่แล้ว

    Thank you sir!

  • @boutarfimanel2893
    @boutarfimanel2893 ปีที่แล้ว

    Thanks 🙏

  • @Lina-zn1yq
    @Lina-zn1yq ปีที่แล้ว

    thank you 🙏

  • @diaconescutiberiu7535
    @diaconescutiberiu7535 ปีที่แล้ว

    What about the dispose of the engine? You got side tracked with the csv. Also how would we get data from sql to dataframe, using pyscopg2 (not sql alchemy). Idea for an extra video: you have a table in your db, with some data. The data in the dataframe changes over time. Task: if record not present in db, create it; if record already in db but some attribute changed, update it; if record no longer in df, remove it also from db

    • @AminBoutarfi
      @AminBoutarfi  ปีที่แล้ว +1

      Thank you for the Thoughtful comment! Yes I got side tracked haha. For Psycopg2 and Pandas, I'm not sure, I always use SQLAlchemy. Also thanks for the video Idea, added it to the list!

  • @yashodiptakore7599
    @yashodiptakore7599 ปีที่แล้ว

    what if password contains @ so servername is picked from first @ symbol.

  • @adityanagdeve8396
    @adityanagdeve8396 ปีที่แล้ว +1

    what if we don't pass the column's name in it? or do we not know the columns?

    • @AminBoutarfi
      @AminBoutarfi  ปีที่แล้ว

      Not sure what situation you referring to here, but knowing column names in either a Pandas Dataframe or a PostgreSQL table is straightforward. Just Google it!
      For example in Pandas you can use: list(df.columns) which returns a list of all column names.
      For PostgreSQL you can use the following code:
      SELECT *
      FROM information_schema.columns
      WHERE table_schema = 'your_schema'
      AND table_name = 'your_table'
      ;

  • @Nite_coder
    @Nite_coder ปีที่แล้ว

    Could you add the code to the description?

    • @AminBoutarfi
      @AminBoutarfi  ปีที่แล้ว

      I added it! Thanks for reminding me!