Uploaded image for project: 'Apache HAWQ'
  1. Apache HAWQ
  2. HAWQ-989

PL/Python function with psycopg2 cannot connect to hawq itself

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: backlog
    • Component/s: Core
    • Labels:
      None

      Description

      For one use case I want to connect to hawq itself from hawq PL/Python function using python psycopg2 library to retrieve some information. However, it errors with "authentication failed for user "gpadmin": invalid authentication method"

      DROP FUNCTION IF EXISTS connection_test();
      DROP FUNCTION
      
      CREATE OR REPLACE FUNCTION connection_test( ) RETURNS text AS
      $$
      import psycopg2
      
      try:
          conn = psycopg2.connect("dbname='gptest' user='gpadmin' host='localhost' port=5432")
          return "Connection successful "
      except Exception , msg :
          return "Exception: {m}".format(m=msg)
      $$
      LANGUAGE 'plpythonu' VOLATILE;
      CREATE FUNCTION
      
      SELECT * FROM connection_test();
                                            connection_test
      --------------------------------------------------------------------------------------------
       Exception: FATAL:  authentication failed for user "gpadmin": invalid authentication method
      
      (1 row)
      

        Attachments

          Activity

            People

            • Assignee:
              huor Ruilong Huo
              Reporter:
              huor Ruilong Huo
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: