psycopg2 python Connect, fetch data, pass SQL query parameters, error handling

แชร์
ฝัง
  • เผยแพร่เมื่อ 15 ม.ค. 2025

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

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

    is their any method to ignore errors in postgresql ?? when we are moving csv file to postgresql database if any row has bad data whole copy is stopped is their any way we can skip the error row and copy all the good rows to database.

    • @learningsoftwareskills
      @learningsoftwareskills  2 ปีที่แล้ว

      Hi, it's easy. Run a for loop on each CSV row and use a try-except inside each iteration. Then only correct rows will be inserted and errors can be ignored
      Hope this helps, cheers 👍

    • @ishantguleria870
      @ishantguleria870 2 ปีที่แล้ว

      @@learningsoftwareskills i have tried but it is not working I have read in few forms that if their is error in any row of CSV file than that CSV file will not be move to postgresql

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

    Awsome!

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

    How to connect using SSH, private key (.pem) and Jump server details?

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

      Hi, I think this link has the code you require
      gist.github.com/deehzee/53c8708417312e5deb32c58b73dca7a5
      Hope this helps, cheers 👍

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

    the reason why i'm here is that error:
    psycopg2.OperationalError.
    Can you help me ?

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

      stackoverflow.com/a/5500831/2746323
      Hi, the issue you have faced is addressed in this stack overflow post.
      Please add the additional host parameter as shown in this solution and check
      Hope this helps, Cheers 👍

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

    it does not work at all

    • @learningsoftwareskills
      @learningsoftwareskills  2 ปีที่แล้ว

      Hi, please provide the details about the issues you faced to use psycopg2. We can try to resolve.
      Please check the port number you are using in your code (Mostly it will be 5432).
      You can also mail to learningsoftwareskils@gmail.com.