code: def _get_db_names(self):
          
          query = """
              SELECT datname FROM pg_database
              WHERE datallowconn AND NOT datistemplate
              AND NOT datname='postgres' AND NOT datname='rdsadmin' ORDER BY 1
          """
          conn = self._connect(self.config['dbname'])
          cursor = conn.cursor(cursor_factory=psycopg2.extras.DictCursor)
          cursor.execute(query)
          datnames = [d['datname'] for d in cursor.fetchall()]
          conn.close()
  
          # Exclude `postgres` database list, unless it is the
          # only database available (required for querying pg_stat_database)
          if not datnames:
              datnames = ['postgres']
  
          return datnames
docs: Try to get a list of db names