{
  "id": "task_libraries:postgres/python",
  "path": "/exapedia/python-postgres-libraries",
  "template": {
    "id": "task_libraries",
    "version": 4
  },
  "title": "Python PostgreSQL libraries",
  "answer": [
    {
      "t": "text",
      "text": "Python PostgreSQL libraries connect applications to a PostgreSQL database, run SQL, and return rows. A driver either calls libpq, the PostgreSQL C client library, or speaks the PostgreSQL wire protocol directly. These libraries let web apps and backend services read and write relational data from Python."
    }
  ],
  "breadcrumb": [
    {
      "label": "Tools"
    },
    {
      "label": "Python PostgreSQL libraries"
    }
  ],
  "sections": [
    {
      "id": "libraries_popularity",
      "anchor": "popularity",
      "heading": "Popularity",
      "blocks": [
        {
          "b": "table",
          "columns": [
            "Library",
            "Monthly downloads",
            "Stars",
            "Last release",
            "License"
          ],
          "rows": [
            [
              [
                {
                  "t": "link",
                  "href": "#psycopg-binary",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F129"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F130"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F136"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F133"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F131"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#psycopg",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F146"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F147"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F153"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F150"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F148"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#asyncpg",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F162"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F163"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F169"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F166"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F164"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#pg",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F178"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F179"
                }
              ],
              [
                {
                  "t": "text",
                  "text": "Not on GitHub"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F182"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F180"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#connectorx",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F194"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F195"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F203"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F198"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F196"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#adbc-driver-postgresql",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F212"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F213"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F221"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F216"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F214"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#aiopg",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F230"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F231"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F239"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F234"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F232"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#pygresql",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F249"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F250"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F258"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F253"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F251"
                }
              ]
            ]
          ],
          "variant": "pop",
          "caption": [
            {
              "t": "text",
              "text": "Downloads: "
            },
            {
              "t": "text",
              "text": "PyPI"
            },
            {
              "t": "text",
              "text": ", last thirty days. Stars and releases: GitHub. Amber: no release in over a year."
            }
          ]
        }
      ],
      "note": [
        {
          "t": "link",
          "href": "#psycopg-binary",
          "label": [
            {
              "t": "fact",
              "fact": "F129"
            }
          ]
        },
        {
          "t": "text",
          "text": " has the most monthly downloads in this comparison, at "
        },
        {
          "t": "fact",
          "fact": "F130"
        },
        {
          "t": "text",
          "text": "."
        }
      ]
    },
    {
      "id": "libraries_capabilities",
      "anchor": "capabilities",
      "heading": "Capabilities",
      "blocks": [
        {
          "b": "table",
          "columns": [
            "Library",
            "Async query API",
            "Sync query API"
          ],
          "rows": [
            [
              [
                {
                  "t": "link",
                  "href": "#psycopg-binary",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F129"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F137"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F138"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#psycopg",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F146"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F154"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F155"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#asyncpg",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F162"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F170"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F171"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#pg",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F178"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F185"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F186"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#connectorx",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F194"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F204"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F205"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#adbc-driver-postgresql",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F212"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F222"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F223"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#aiopg",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F230"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F240"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F241"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#pygresql",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F249"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F259"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F260"
                }
              ]
            ]
          ],
          "variant": "cap"
        }
      ]
    },
    {
      "id": "libraries_entries",
      "anchor": "libraries",
      "heading": "Libraries",
      "blocks": [
        {
          "b": "entry",
          "anchor": "psycopg-binary",
          "name": [
            {
              "t": "fact",
              "fact": "F129"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/psycopg/psycopg2"
            },
            {
              "label": "PyPI",
              "href": "https://pypi.org/project/psycopg2-binary"
            },
            {
              "label": "Docs",
              "href": "https://pypi.org/pypi/psycopg2-binary/2.9.13/json"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F12"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F130"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F136"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F132"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F131"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://pypi.org/pypi/psycopg2-binary/2.9.13/json",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F129"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F13"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F14"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F15"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F16"
                }
              ]
            }
          ],
          "cons": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F17"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F18"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F19"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F20"
                }
              ]
            }
          ],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F144"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F145"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/django/django",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F144"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "python",
              "code": "@async_unsafe\ndef get_new_connection(self, conn_params):\n    # self.isolation_level must be set:\n    # - after connecting to the database in order to obtain the database's\n    #   default when no value is explicitly specified in options.\n    # - before calling _set_autocommit() because if autocommit is on, that\n    #   will set connection.isolation_level to ISOLATION_LEVEL_AUTOCOMMIT.\n    options = self.settings_dict[\"OPTIONS\"]\n    set_isolation_level = False\n    try:\n        isolation_level_value = options[\"isolation_level\"]\n    except KeyError:\n        self.isolation_level = IsolationLevel.READ_COMMITTED\n    else:\n        # Set the isolation level to the value from OPTIONS.\n        try:\n            self.isolation_level = IsolationLevel(isolation_level_value)\n            set_isolation_level = True\n        except ValueError:\n            raise ImproperlyConfigured(\n                f\"Invalid transaction isolation level {isolation_level_value} \"\n                f\"specified. Use one of the psycopg.IsolationLevel values.\"\n            )\n    if self.pool:\n        # If nothing else has opened the pool, open it now.\n        self.pool.open()\n        connection = self.pool.getconn()\n    else:\n        connection = self.Database.connect(**conn_params)\n    if set_isolation_level:\n        connection.isolation_level = self.isolation_level\n    if not is_psycopg3:\n        # Register dummy loads() to avoid a round trip from psycopg2's\n        # decode to json.dumps() to json.loads(), when using a custom\n        # decoder in JSONField.\n        psycopg2.extras.register_default_jsonb(\n            conn_or_curs=connection, loads=lambda x: x\n        )\n    return connection\n",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/django/django/blob/f24f38c6b2825f15628c07bf2892f1664eed9361/django/db/backends/postgresql/base.py#L316-L354",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F143"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=Python%20projects%20using%20psycopg2-binary%20for%20PostgreSQL%20query%20execution%2C%20transaction%20handling%2C%20connection%20setup%20and%20COPY%20streaming&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F129"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "python",
              "code": "import psycopg2\nconn = psycopg2.connect(\"dbname=test user=postgres\")\ncur = conn.cursor()\ncur.execute(\"SELECT 1\")\nprint(cur.fetchone())\ncur.close()\nconn.close()\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://www.psycopg.org/docs/usage.html",
                  "label": [
                    {
                      "t": "text",
                      "text": "usage.html"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F134"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "psycopg",
          "name": [
            {
              "t": "fact",
              "fact": "F146"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/psycopg/psycopg"
            },
            {
              "label": "PyPI",
              "href": "https://pypi.org/project/psycopg"
            },
            {
              "label": "Docs",
              "href": "https://pypi.org/pypi/psycopg/3.3.9/json"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F38"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F147"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F153"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F149"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F148"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://pypi.org/pypi/psycopg/3.3.9/json",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F146"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F39"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F40"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F41"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F42"
                }
              ]
            }
          ],
          "cons": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F43"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F44"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F45"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F46"
                }
              ]
            }
          ],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F160"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F161"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/dbcli/pgcli",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F160"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "python",
              "code": "def execute_normal_sql(self, split_sql):\n    \"\"\"Returns tuple (title, rows, headers, status)\"\"\"\n    _logger.debug(\"Regular sql statement. sql: %r\", split_sql)\n\n    title = \"\"\n\n    def handle_notices(n):\n        nonlocal title\n        title = f\"{title}\"\n        if n.message_primary is not None:\n            title = f\"{title}\\n{n.message_primary}\"\n        if n.message_detail is not None:\n            title = f\"{title}\\n{n.message_detail}\"\n\n    self.conn.add_notice_handler(handle_notices)\n\n    if self.is_virtual_database() and \"show help\" in split_sql.lower():\n        # see https://github.com/psycopg/psycopg/issues/303\n        # special case \"show help\" in pgbouncer\n        res = self.conn.pgconn.exec_(split_sql.encode())\n        return title, None, None, res.command_status.decode()\n\n    cur = self.conn.cursor()\n    cur.execute(split_sql)\n\n    # cur.description will be None for operations that do not return\n    # rows.\n    if cur.description:\n        headers = [x[0] for x in cur.description]\n        return title, cur, headers, cur.statusmessage\n    elif cur.protocol_error:\n        _logger.debug(\"Protocol error, unsupported command.\")\n        return title, None, None, cur.protocol_message\n    else:\n        _logger.debug(\"No rows in result.\")\n        return title, None, None, cur.statusmessage\n",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/dbcli/pgcli/blob/dc9ce9447e0fc005a347b75b7eb5d541e282b1c1/pgcli/pgexecute.py#L451-L486",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F159"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=Python%20projects%20using%20psycopg%20for%20PostgreSQL%20query%20execution%2C%20transaction%20handling%2C%20connection%20setup%20and%20COPY%20streaming&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F146"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "python",
              "code": "import psycopg\nwith psycopg.connect(\"dbname=test user=postgres\") as conn:\n    print(conn.execute(\"SELECT 1\").fetchone())\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://www.psycopg.org/psycopg3/docs/basic/usage.html",
                  "label": [
                    {
                      "t": "text",
                      "text": "usage.html"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F151"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "asyncpg",
          "name": [
            {
              "t": "fact",
              "fact": "F162"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/MagicStack/asyncpg"
            },
            {
              "label": "PyPI",
              "href": "https://pypi.org/project/asyncpg"
            },
            {
              "label": "Docs",
              "href": "https://pypi.org/pypi/asyncpg/0.32.0/json"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F63"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F163"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F169"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F165"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F164"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://pypi.org/pypi/asyncpg/0.32.0/json",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F162"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F64"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F65"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F66"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F67"
                }
              ]
            }
          ],
          "cons": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F68"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F69"
                }
              ]
            }
          ],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F176"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F177"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/encode/databases",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F176"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "python",
              "code": "async def start(\n    self, is_root: bool, extra_options: typing.Dict[typing.Any, typing.Any]\n) -> None:\n    assert self._connection._connection is not None, \"Connection is not acquired\"\n    self._transaction = self._connection._connection.transaction(**extra_options)\n    await self._transaction.start()\n",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/encode/databases/blob/ae3fb16f40201d9ed0ed31bea31a289127169568/databases/backends/postgres.py#L205-L210",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F175"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=Python%20projects%20using%20asyncpg%20for%20PostgreSQL%20query%20execution%2C%20transaction%20handling%2C%20connection%20setup%20and%20COPY%20streaming&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F162"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "python",
              "code": "import asyncio\nimport asyncpg\nasync def main():\n    conn = await asyncpg.connect(\"postgresql://postgres@localhost/test\")\n    try:\n        print(await conn.fetchval(\"SELECT 1\"))\n    finally:\n        await conn.close()\nasyncio.run(main())\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://magicstack.github.io/asyncpg/current/api/index.html",
                  "label": [
                    {
                      "t": "text",
                      "text": "README.rst"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F167"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "pg",
          "name": [
            {
              "t": "fact",
              "fact": "F178"
            }
          ],
          "links": [
            {
              "label": "PyPI",
              "href": "https://pypi.org/project/pg8000"
            },
            {
              "label": "Docs",
              "href": "https://pypi.org/pypi/pg8000/1.31.6/json"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F84"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F179"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F181"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F180"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://pypi.org/pypi/pg8000/1.31.6/json",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F178"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F85"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F86"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F87"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F88"
                }
              ]
            }
          ],
          "cons": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F89"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F90"
                }
              ]
            }
          ],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F192"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F193"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/sqlalchemy/sqlalchemy",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F192"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "python",
              "code": "def set_isolation_level(self, dbapi_connection, level):\n    level = level.replace(\"_\", \" \")\n\n    if level == \"AUTOCOMMIT\":\n        dbapi_connection.autocommit = True\n    else:\n        dbapi_connection.autocommit = False\n        cursor = dbapi_connection.cursor()\n        cursor.execute(\n            \"SET SESSION CHARACTERISTICS AS TRANSACTION \"\n            f\"ISOLATION LEVEL {level}\"\n        )\n        cursor.execute(\"COMMIT\")\n        cursor.close()\n",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/sqlalchemy/sqlalchemy/blob/fe8e67751891de18ba27171bbc8aa23b28bb8348/lib/sqlalchemy/dialects/postgresql/pg8000.py#L517-L530",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F191"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=Python%20projects%20using%20pg8000%20for%20PostgreSQL%20query%20execution%2C%20transaction%20handling%2C%20connection%20setup%20and%20COPY%20streaming&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F178"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "python",
              "code": "import pg8000.dbapi\nconn = pg8000.dbapi.connect(user=\"postgres\", database=\"test\")\ncur = conn.cursor()\ncur.execute(\"SELECT 1\")\nprint(cur.fetchone())\ncur.close()\nconn.close()\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://pypi.org/pypi/pg8000/1.31.6/json",
                  "label": [
                    {
                      "t": "text",
                      "text": "README.md"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F183"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "connectorx",
          "name": [
            {
              "t": "fact",
              "fact": "F194"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/sfu-db/connector-x"
            },
            {
              "label": "PyPI",
              "href": "https://pypi.org/project/connectorx"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F201"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F195"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F203"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F197"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F196"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://github.com/sfu-db/connector-x",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F194"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [],
          "cons": [],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F210"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F211"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/pola-rs/polars",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F210"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "python",
              "code": "def _read_sql_connectorx(\n    query: str | list[str],\n    connection_uri: str,\n    partition_on: str | None = None,\n    partition_range: tuple[int, int] | None = None,\n    partition_num: int | None = None,\n    protocol: str | None = None,\n    schema_overrides: SchemaDict | None = None,\n    pre_execution_query: str | list[str] | None = None,\n) -> DataFrame:\n    cx = import_optional(\"connectorx\")\n\n    if parse_version(cx.__version__) < (0, 4, 2):\n        if pre_execution_query:\n            msg = \"'pre_execution_query' is only supported in connectorx version 0.4.2 or later\"\n            raise ValueError(msg)\n        return_type = \"arrow2\"\n        pre_execution_args = {}\n    else:\n        return_type = \"arrow\"\n        pre_execution_args = {\"pre_execution_query\": pre_execution_query}\n\n    try:\n        tbl = cx.read_sql(\n            conn=connection_uri,\n            query=query,\n            return_type=return_type,\n            partition_on=partition_on,\n            partition_range=partition_range,\n            partition_num=partition_num,\n            protocol=protocol,\n            **pre_execution_args,\n        )\n    except BaseException as err:\n        # basic sanitisation of /user:pass/ credentials exposed in connectorx errs\n        errmsg = re.sub(\"://[^:]+:[^:]+@\", \"://***:***@\", str(err))\n        raise type(err)(errmsg) from err\n\n    return from_arrow(tbl, schema_overrides=schema_overrides)  # type: ignore[return-value]\n",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/pola-rs/polars/blob/c5f0f25b2ed6498dd47d3ec619ef3a1a90c0788b/py-polars/src/polars/io/database/_utils.py#L29-L67",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F209"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=connectorx%20GitHub%20projects",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F194"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "python",
              "code": "import connectorx as cx\ncx.read_sql(\"postgresql://username:password@server:port/database\", \"SELECT * FROM lineitem\")\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://github.com/sfu-db/connector-x",
                  "label": [
                    {
                      "t": "text",
                      "text": "README.md"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F199"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "adbc-driver-postgresql",
          "name": [
            {
              "t": "fact",
              "fact": "F212"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/apache/arrow-adbc"
            },
            {
              "label": "PyPI",
              "href": "https://pypi.org/project/adbc-driver-postgresql"
            },
            {
              "label": "Docs",
              "href": "https://arrow.apache.org/adbc/current/driver/postgresql.html"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F219"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F213"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F221"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F215"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F214"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://arrow.apache.org/adbc/current/driver/postgresql.html",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F212"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [],
          "cons": [],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F228"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F229"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/pola-rs/polars",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F228"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "python",
              "code": "def _open_adbc_connection(connection_uri: str) -> Any:\n    driver_name = _get_adbc_driver_name_from_uri(connection_uri)\n    module_name = _get_adbc_module_name_from_uri(connection_uri)\n\n    # some backends require the driver name to be stripped from the URI\n    if driver_name in (\"duckdb\", \"snowflake\", \"sqlite\"):\n        connection_uri = re.sub(f\"^{driver_name}:/{{,3}}\", \"\", connection_uri)\n\n    try:\n        adbc_driver = _import_optional_adbc_driver(module_name)\n    except ModuleUpgradeRequiredError:\n        raise\n    except ModuleNotFoundError as err:\n        if (found := _find_installed_adbc_driver_for(driver_name, err)) is None:\n            raise\n        # load the driver library through the generic driver manager\n        dbapi = import_module(\"adbc_driver_manager.dbapi\")\n        library, entrypoint = found\n        return dbapi.connect(\n            driver=library,\n            entrypoint=entrypoint,\n            db_kwargs=_adbc_db_kwargs(driver_name, connection_uri),\n        )\n\n    return adbc_driver.connect(connection_uri)\n",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/pola-rs/polars/blob/6a40f554cd1583615374fb1fb128c130ecf9549e/py-polars/src/polars/io/database/_utils.py#L233-L257",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F227"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=adbc-driver-postgresql%20GitHub%20projects",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F212"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "python",
              "code": "import adbc_driver_postgresql.dbapi as dbapi\nwith dbapi.connect(\"postgresql://postgres@localhost/test\") as conn:\n    with conn.cursor() as cur:\n        cur.execute(\"SELECT 1\")\n        print(cur.fetchone())\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://api.github.com/repos/apache/arrow-adbc/git/blobs/3a52b30780617d074483ac245097c0f276db8b44",
                  "label": [
                    {
                      "t": "text",
                      "text": "dbapi.py"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F217"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "aiopg",
          "name": [
            {
              "t": "fact",
              "fact": "F230"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/aio-libs/aiopg"
            },
            {
              "label": "PyPI",
              "href": "https://pypi.org/project/aiopg"
            },
            {
              "label": "Docs",
              "href": "https://aiopg.readthedocs.io/en/stable/"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F237"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F231"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F239"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F233"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F232"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://aiopg.readthedocs.io/en/stable/",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F230"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [],
          "cons": [],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F247"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F248"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/aio-libs/aiohttp-demos",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F247"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "python",
              "code": "async def pg_context(app):\n    conf = app['config']['postgres']\n    engine = await aiopg.sa.create_engine(\n        database=conf['database'],\n        user=conf['user'],\n        password=conf['password'],\n        host=conf['host'],\n        port=conf['port'],\n        minsize=conf['minsize'],\n        maxsize=conf['maxsize'],\n    )\n    app['db'] = engine\n\n    yield\n\n    app['db'].close()\n    await app['db'].wait_closed()\n",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/aio-libs/aiohttp-demos/blob/22c4cb112d3ecf8df7113ba337570ba2081d4797/demos/polls/aiohttpdemo_polls/db.py#L36-L52",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F246"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=aiopg%20GitHub%20projects",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F230"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "python",
              "code": "import asyncio\nimport aiopg\nasync def main():\n    async with aiopg.create_pool(\"dbname=test user=postgres host=localhost\") as pool:\n        async with pool.acquire() as conn:\n            async with conn.cursor() as cur:\n                await cur.execute(\"SELECT 1\")\n                print(await cur.fetchone())\nasyncio.run(main())\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://aiopg.readthedocs.io/en/stable/",
                  "label": [
                    {
                      "t": "text",
                      "text": "index.html"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F235"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "pygresql",
          "name": [
            {
              "t": "fact",
              "fact": "F249"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/PyGreSQL/PyGreSQL"
            },
            {
              "label": "PyPI",
              "href": "https://pypi.org/project/pygresql"
            },
            {
              "label": "Docs",
              "href": "https://pypi.org/pypi/pygresql/6.2.3/json"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F256"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F250"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F258"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F252"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F251"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://pypi.org/pypi/pygresql/6.2.3/json",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F249"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [],
          "cons": [],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F265"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F266"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/sqlobject/sqlobject",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F265"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "python",
              "code": "def makeConnection(self):\n    try:\n        if self.driver in ('odbc', 'pyodbc', 'pypyodbc'):\n            self.debugWriter.write(\n                \"ODBC connect string: \" + self.odbc_conn_str)\n            conn = self.module.connect(self.odbc_conn_str)\n        elif self.use_dsn:\n            conn = self.module.connect(self.dsn)\n        else:\n            conn = self.module.connect(**self.dsn_dict)\n    except self.module.OperationalError as e:\n        raise dberrors.OperationalError(\n            ErrorMessage(e, \"used connection string %r\" % self.dsn))\n\n    # For printDebug in _executeRetry\n    self._connectionNumbers[id(conn)] = self._connectionCount\n\n    if self.autoCommit:\n        self._setAutoCommit(conn, 1)\n    c = conn.cursor()\n    if self.schema:\n        self._executeRetry(conn, c, \"SET search_path TO \" + self.schema)\n    dbEncoding = self.dbEncoding\n    if dbEncoding:\n        if self.driver in ('odbc', 'pyodbc'):\n            conn.setdecoding(self.module.SQL_CHAR, encoding=dbEncoding)\n            conn.setdecoding(self.module.SQL_WCHAR, encoding=dbEncoding)\n            if PY2:\n                conn.setencoding(str, encoding=dbEncoding)\n                conn.setencoding(unicode, encoding=dbEncoding)  # noqa\n            else:\n                conn.setencoding(encoding=dbEncoding)\n        self._executeRetry(conn, c,\n                           \"SET client_encoding TO '%s'\" % dbEncoding)\n    c.close()\n    return conn\n",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/sqlobject/sqlobject/blob/1dfb07bca80c35f2575e00e05fc9bdf6a40d6421/sqlobject/postgres/pgconnection.py#L219-L254",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F264"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=pygresql%20GitHub%20projects",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F249"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "python",
              "code": "import pgdb\nconn = pgdb.connect(database=\"test\", user=\"postgres\")\ncur = conn.cursor()\ncur.execute(\"SELECT 1\")\nprint(cur.fetchone())\ncur.close()\nconn.close()\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://pygresql.github.io/contents/pgdb/module.html",
                  "label": [
                    {
                      "t": "text",
                      "text": "module.html"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F254"
            }
          ]
        }
      ]
    }
  ],
  "questions": [
    {
      "q": "Which Python PostgreSQL library should I use?",
      "a": [
        {
          "t": "link",
          "href": "#psycopg",
          "label": [
            {
              "t": "text",
              "text": "Psycopg"
            }
          ]
        },
        {
          "t": "text",
          "text": " suits new projects and offers synchronous and native async interfaces. "
        },
        {
          "t": "link",
          "href": "#asyncpg",
          "label": [
            {
              "t": "text",
              "text": "asyncpg"
            }
          ]
        },
        {
          "t": "text",
          "text": " suits asyncio services that want a dedicated protocol client and pool. "
        },
        {
          "t": "link",
          "href": "#pg",
          "label": [
            {
              "t": "fact",
              "fact": "F178"
            }
          ]
        },
        {
          "t": "text",
          "text": " suits environments that cannot install libpq."
        }
      ]
    },
    {
      "q": "psycopg2 vs Psycopg: which should I use?",
      "a": [
        {
          "t": "link",
          "href": "#psycopg",
          "label": [
            {
              "t": "text",
              "text": "Psycopg"
            }
          ]
        },
        {
          "t": "text",
          "text": " is the current generation of the adapter. Its publisher recommends it for new projects and keeps "
        },
        {
          "t": "link",
          "href": "#psycopg-binary",
          "label": [
            {
              "t": "fact",
              "fact": "F129"
            }
          ]
        },
        {
          "t": "text",
          "text": " for existing integrations."
        }
      ]
    },
    {
      "q": "What is asyncpg?",
      "a": [
        {
          "t": "link",
          "href": "#asyncpg",
          "label": [
            {
              "t": "text",
              "text": "asyncpg"
            }
          ]
        },
        {
          "t": "text",
          "text": " is an asyncio PostgreSQL driver with its own protocol client and connection pool. It does not offer a synchronous DB-API interface."
        }
      ]
    },
    {
      "q": "What is pg8000?",
      "a": [
        {
          "t": "link",
          "href": "#pg",
          "label": [
            {
              "t": "fact",
              "fact": "F178"
            }
          ]
        },
        {
          "t": "text",
          "text": " is a pure Python PostgreSQL driver with both DB-API and native query interfaces. It does not depend on libpq."
        }
      ]
    }
  ],
  "facts": {
    "F1": {
      "label": "Library name, psycopg2-binary",
      "display": "Psycopg 2 binary",
      "asOf": "2026-11-17"
    },
    "F2": {
      "label": "Monthly downloads, psycopg2-binary",
      "display": "230.8M",
      "asOf": "2026-11-16"
    },
    "F3": {
      "label": "License, psycopg2-binary",
      "display": "LGPL with exceptions",
      "asOf": "2026-11-17"
    },
    "F4": {
      "label": "Package release, psycopg2-binary",
      "display": "2.9.13, Sep 2026",
      "asOf": "2026-09-09"
    },
    "F5": {
      "label": "Package release date, psycopg2-binary",
      "display": "Sep 2026",
      "asOf": "2026-09-09"
    },
    "F6": {
      "label": "Repository stars, psycopg2-binary",
      "display": "3.7K",
      "asOf": "2026-11-17"
    },
    "F7": {
      "label": "Sync queries, psycopg2-binary",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F8": {
      "label": "Async queries, psycopg2-binary",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F9": {
      "label": "Connection pools, psycopg2-binary",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F10": {
      "label": "COPY streaming, psycopg2-binary",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F11": {
      "label": "Install, psycopg2-binary",
      "display": "pip install psycopg2-binary",
      "asOf": "2026-11-17"
    },
    "F12": {
      "label": "What it does, psycopg2-binary",
      "display": "Packages the Psycopg 2 PostgreSQL adapter as a binary wheel.",
      "asOf": "2026-11-17"
    },
    "F13": {
      "label": "strengths lead, psycopg2-binary",
      "display": "Wraps PostgreSQL’s libpq client",
      "asOf": "2026-11-17"
    },
    "F14": {
      "label": "strengths, psycopg2-binary",
      "display": "Use the established libpq-backed PostgreSQL adapter.",
      "asOf": "2026-11-17"
    },
    "F15": {
      "label": "strengths lead, psycopg2-binary",
      "display": "Includes threaded connection pooling",
      "asOf": "2026-11-17"
    },
    "F16": {
      "label": "strengths, psycopg2-binary",
      "display": "Use ThreadedConnectionPool when application threads need pooled database connections.",
      "asOf": "2026-11-17"
    },
    "F17": {
      "label": "limitations lead, psycopg2-binary",
      "display": "Binary dependencies update separately",
      "asOf": "2026-11-17"
    },
    "F18": {
      "label": "limitations, psycopg2-binary",
      "display": "Upgrade the package to update its bundled libpq and libssl libraries.",
      "asOf": "2026-11-17"
    },
    "F19": {
      "label": "limitations lead, psycopg2-binary",
      "display": "Async mode disables COPY",
      "asOf": "2026-11-17"
    },
    "F20": {
      "label": "limitations, psycopg2-binary",
      "display": "Use a synchronous connection for Psycopg COPY operations.",
      "asOf": "2026-11-17"
    },
    "F21": {
      "label": "Quickstart, psycopg2-binary",
      "display": "import psycopg2\n\n# Connect to an existing database\nconn = psycopg2.connect(\"dbname=test user=postgres\")\n\n# Open a cursor to perform database operations\ncur = conn.cursor()\n\n# Execute a command: this creates a new table\ncur.execute(\"CREATE TABLE test (id serial PRIMARY KEY, num integer, data varchar);\")\n\n# Pass data to fill a query placeholders and let Psycopg perform\n# the correct conversion (no more SQL injections!)\ncur.execute(\"INSERT INTO test (num, data) VALUES (%s, %s)\",\n     (100, \"abc'def\"))\n\n# Query the database and obtain data as Python objects\ncur.execute(\"SELECT * FROM test;\")\ncur.fetchone()\n\n# Make the changes to the database persistent\nconn.commit()\n\n# Close communication with the database\ncur.close()\nconn.close()\n",
      "asOf": "2026-11-17"
    },
    "F22": {
      "label": "Project function, psycopg2-binary",
      "display": "@async_unsafe\ndef get_new_connection(self, conn_params):\n    # self.isolation_level must be set:\n    # - after connecting to the database in order to obtain the database's\n    #   default when no value is explicitly specified in options.\n    # - before calling _set_autocommit() because if autocommit is on, that\n    #   will set connection.isolation_level to ISOLATION_LEVEL_AUTOCOMMIT.\n    options = self.settings_dict[\"OPTIONS\"]\n    set_isolation_level = False\n    try:\n        isolation_level_value = options[\"isolation_level\"]\n    except KeyError:\n        self.isolation_level = IsolationLevel.READ_COMMITTED\n    else:\n        # Set the isolation level to the value from OPTIONS.\n        try:\n            self.isolation_level = IsolationLevel(isolation_level_value)\n            set_isolation_level = True\n        except ValueError:\n            raise ImproperlyConfigured(\n                f\"Invalid transaction isolation level {isolation_level_value} \"\n                f\"specified. Use one of the psycopg.IsolationLevel values.\"\n            )\n    if self.pool:\n        # If nothing else has opened the pool, open it now.\n        self.pool.open()\n        connection = self.pool.getconn()\n    else:\n        connection = self.Database.connect(**conn_params)\n    if set_isolation_level:\n        connection.isolation_level = self.isolation_level\n    if not is_psycopg3:\n        # Register dummy loads() to avoid a round trip from psycopg2's\n        # decode to json.dumps() to json.loads(), when using a custom\n        # decoder in JSONField.\n        psycopg2.extras.register_default_jsonb(\n            conn_or_curs=connection, loads=lambda x: x\n        )\n    return connection\n",
      "asOf": "2026-11-17"
    },
    "F23": {
      "label": "Project function reference, psycopg2-binary",
      "display": "base.py · get_new_connection()",
      "asOf": "2026-11-17"
    },
    "F24": {
      "label": "Project repository, psycopg2-binary",
      "display": "django/django",
      "asOf": "2026-11-17"
    },
    "F25": {
      "label": "Project stars, django/django",
      "display": "91.8K",
      "asOf": "2026-11-17"
    },
    "F26": {
      "label": "Project push date, django/django",
      "display": "Nov 2026",
      "asOf": "2026-11-13"
    },
    "F27": {
      "label": "Library name, psycopg",
      "display": "Psycopg 3",
      "asOf": "2026-11-17"
    },
    "F28": {
      "label": "Monthly downloads, psycopg",
      "display": "206.4M",
      "asOf": "2026-11-16"
    },
    "F29": {
      "label": "License, psycopg",
      "display": "LGPL-3.0-only",
      "asOf": "2026-11-17"
    },
    "F30": {
      "label": "Package release, psycopg",
      "display": "3.3.9, Nov 2026",
      "asOf": "2026-11-12"
    },
    "F31": {
      "label": "Package release date, psycopg",
      "display": "Nov 2026",
      "asOf": "2026-11-12"
    },
    "F32": {
      "label": "Repository stars, psycopg",
      "display": "2.5K",
      "asOf": "2026-11-17"
    },
    "F33": {
      "label": "Sync queries, psycopg",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F34": {
      "label": "Async queries, psycopg",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F35": {
      "label": "Connection pools, psycopg",
      "display": "Via plugin",
      "asOf": "2026-11-17"
    },
    "F36": {
      "label": "COPY streaming, psycopg",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F37": {
      "label": "Install, psycopg",
      "display": "pip install \"psycopg[binary]\"",
      "asOf": "2026-11-17"
    },
    "F38": {
      "label": "What it does, psycopg",
      "display": "Provides PostgreSQL connections, cursors, and query execution for Python.",
      "asOf": "2026-11-17"
    },
    "F39": {
      "label": "strengths lead, psycopg",
      "display": "Offers sync and async interfaces",
      "asOf": "2026-11-17"
    },
    "F40": {
      "label": "strengths, psycopg",
      "display": "Use similar connection and cursor patterns in synchronous and asynchronous code.",
      "asOf": "2026-11-17"
    },
    "F41": {
      "label": "strengths lead, psycopg",
      "display": "Streams PostgreSQL COPY data",
      "asOf": "2026-11-17"
    },
    "F42": {
      "label": "strengths, psycopg",
      "display": "Read or write COPY data through a managed Copy object.",
      "asOf": "2026-11-17"
    },
    "F43": {
      "label": "limitations lead, psycopg",
      "display": "Pooling needs another package",
      "asOf": "2026-11-17"
    },
    "F44": {
      "label": "limitations, psycopg",
      "display": "Install psycopg_pool or the pool extra to use connection pools.",
      "asOf": "2026-11-17"
    },
    "F45": {
      "label": "limitations lead, psycopg",
      "display": "Windows async needs another loop",
      "asOf": "2026-11-17"
    },
    "F46": {
      "label": "limitations, psycopg",
      "display": "Select an event loop compatible with Psycopg asynchronous connections.",
      "asOf": "2026-11-17"
    },
    "F47": {
      "label": "Quickstart, psycopg",
      "display": "# Note: the module name is psycopg, not psycopg3\nimport psycopg\n\n# Connect to an existing database\nwith psycopg.connect(\"dbname=test user=postgres\") as conn:\n\n    # Open a cursor to perform database operations\n    with conn.cursor() as cur:\n\n        # Execute a command: this creates a new table\n        cur.execute(\"\"\"\n            CREATE TABLE test (\n                id serial PRIMARY KEY,\n                num integer,\n                data text)\n            \"\"\")\n\n        # Pass data to fill a query placeholders and let Psycopg perform\n        # the correct conversion (no SQL injections!)\n        cur.execute(\n            \"INSERT INTO test (num, data) VALUES (%s, %s)\",\n            (100, \"abc'def\"))\n\n        # Query the database and obtain data as Python objects.\n        cur.execute(\"SELECT * FROM test\")\n        print(cur.fetchone())\n        # will print (1, 100, \"abc'def\")\n\n        # You can use `cur.executemany()` to perform an operation in batch\n        cur.executemany(\n            \"INSERT INTO test (num) values (%s)\",\n            [(33,), (66,), (99,)])\n\n        # You can use `cur.fetchmany()`, `cur.fetchall()` to return a list\n        # of several records, or even iterate on the cursor\n        cur.execute(\"SELECT id, num FROM test order by num\")\n        for record in cur:\n            print(record)\n\n        # Make the changes to the database persistent\n        conn.commit()\n\n",
      "asOf": "2026-11-17"
    },
    "F48": {
      "label": "Project function, psycopg",
      "display": "def execute_normal_sql(self, split_sql):\n    \"\"\"Returns tuple (title, rows, headers, status)\"\"\"\n    _logger.debug(\"Regular sql statement. sql: %r\", split_sql)\n\n    title = \"\"\n\n    def handle_notices(n):\n        nonlocal title\n        title = f\"{title}\"\n        if n.message_primary is not None:\n            title = f\"{title}\\n{n.message_primary}\"\n        if n.message_detail is not None:\n            title = f\"{title}\\n{n.message_detail}\"\n\n    self.conn.add_notice_handler(handle_notices)\n\n    if self.is_virtual_database() and \"show help\" in split_sql.lower():\n        # see https://github.com/psycopg/psycopg/issues/303\n        # special case \"show help\" in pgbouncer\n        res = self.conn.pgconn.exec_(split_sql.encode())\n        return title, None, None, res.command_status.decode()\n\n    cur = self.conn.cursor()\n    cur.execute(split_sql)\n\n    # cur.description will be None for operations that do not return\n    # rows.\n    if cur.description:\n        headers = [x[0] for x in cur.description]\n        return title, cur, headers, cur.statusmessage\n    elif cur.protocol_error:\n        _logger.debug(\"Protocol error, unsupported command.\")\n        return title, None, None, cur.protocol_message\n    else:\n        _logger.debug(\"No rows in result.\")\n        return title, None, None, cur.statusmessage\n",
      "asOf": "2026-11-17"
    },
    "F49": {
      "label": "Project function reference, psycopg",
      "display": "pgexecute.py · execute_normal_sql()",
      "asOf": "2026-11-17"
    },
    "F50": {
      "label": "Project repository, psycopg",
      "display": "dbcli/pgcli",
      "asOf": "2026-11-17"
    },
    "F51": {
      "label": "Project stars, dbcli/pgcli",
      "display": "13.4K",
      "asOf": "2026-11-17"
    },
    "F52": {
      "label": "Project push date, dbcli/pgcli",
      "display": "Nov 2026",
      "asOf": "2026-11-04"
    },
    "F53": {
      "label": "Library name, asyncpg",
      "display": "asyncpg",
      "asOf": "2026-11-17"
    },
    "F54": {
      "label": "Monthly downloads, asyncpg",
      "display": "138.9M",
      "asOf": "2026-11-16"
    },
    "F55": {
      "label": "License, asyncpg",
      "display": "Apache-2.0",
      "asOf": "2026-11-17"
    },
    "F56": {
      "label": "Package release, asyncpg",
      "display": "0.32.0, Oct 2026",
      "asOf": "2026-10-06"
    },
    "F57": {
      "label": "Package release date, asyncpg",
      "display": "Oct 2026",
      "asOf": "2026-10-06"
    },
    "F58": {
      "label": "Repository stars, asyncpg",
      "display": "8.1K",
      "asOf": "2026-11-17"
    },
    "F59": {
      "label": "Async queries, asyncpg",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F60": {
      "label": "Connection pools, asyncpg",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F61": {
      "label": "COPY streaming, asyncpg",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F62": {
      "label": "Install, asyncpg",
      "display": "pip install asyncpg",
      "asOf": "2026-11-17"
    },
    "F63": {
      "label": "What it does, asyncpg",
      "display": "Implements PostgreSQL’s protocol for Python asyncio applications.",
      "asOf": "2026-11-17"
    },
    "F64": {
      "label": "strengths lead, asyncpg",
      "display": "Includes an asynchronous connection pool",
      "asOf": "2026-11-17"
    },
    "F65": {
      "label": "strengths, asyncpg",
      "display": "Acquire, use, and return connections through the built-in pool.",
      "asOf": "2026-11-17"
    },
    "F66": {
      "label": "strengths lead, asyncpg",
      "display": "Converts PostgreSQL types automatically",
      "asOf": "2026-11-17"
    },
    "F67": {
      "label": "strengths, asyncpg",
      "display": "Receive arrays, composite values, and other PostgreSQL types as Python values.",
      "asOf": "2026-11-17"
    },
    "F68": {
      "label": "limitations lead, asyncpg",
      "display": "Prepared objects expire after release",
      "asOf": "2026-11-17"
    },
    "F69": {
      "label": "limitations, asyncpg",
      "display": "Recreate statement and cursor objects when acquiring a connection again.",
      "asOf": "2026-11-17"
    },
    "F70": {
      "label": "Quickstart, asyncpg",
      "display": "import asyncio\nimport asyncpg\n\nasync def run():\n    conn = await asyncpg.connect(user='user', password='password',\n                                 database='database', host='127.0.0.1')\n    values = await conn.fetch(\n        'SELECT * FROM mytable WHERE id = $1',\n        10,\n    )\n    await conn.close()\n\nasyncio.run(run())\n",
      "asOf": "2026-11-17"
    },
    "F71": {
      "label": "Project function, asyncpg",
      "display": "async def start(\n    self, is_root: bool, extra_options: typing.Dict[typing.Any, typing.Any]\n) -> None:\n    assert self._connection._connection is not None, \"Connection is not acquired\"\n    self._transaction = self._connection._connection.transaction(**extra_options)\n    await self._transaction.start()\n",
      "asOf": "2026-11-17"
    },
    "F72": {
      "label": "Project function reference, asyncpg",
      "display": "postgres.py · start()",
      "asOf": "2026-11-17"
    },
    "F73": {
      "label": "Project repository, asyncpg",
      "display": "encode/databases",
      "asOf": "2026-11-17"
    },
    "F74": {
      "label": "Project stars, encode/databases",
      "display": "4.0K",
      "asOf": "2026-11-17"
    },
    "F75": {
      "label": "Project push date, encode/databases",
      "display": "May 2024",
      "asOf": "2024-05-21"
    },
    "F76": {
      "label": "Library name, pg8000",
      "display": "pg8000",
      "asOf": "2026-11-17"
    },
    "F77": {
      "label": "Monthly downloads, pg8000",
      "display": "53.7M",
      "asOf": "2026-11-16"
    },
    "F78": {
      "label": "License, pg8000",
      "display": "BSD 3-Clause License",
      "asOf": "2026-11-17"
    },
    "F79": {
      "label": "Package release, pg8000",
      "display": "1.31.6, Oct 2026",
      "asOf": "2026-10-26"
    },
    "F80": {
      "label": "Package release date, pg8000",
      "display": "Oct 2026",
      "asOf": "2026-10-26"
    },
    "F81": {
      "label": "Sync queries, pg8000",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F82": {
      "label": "COPY streaming, pg8000",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F83": {
      "label": "Install, pg8000",
      "display": "pip install pg8000",
      "asOf": "2026-11-17"
    },
    "F84": {
      "label": "What it does, pg8000",
      "display": "Provides a pure-Python PostgreSQL driver that implements DB-API.",
      "asOf": "2026-11-17"
    },
    "F85": {
      "label": "strengths lead, pg8000",
      "display": "Runs as a pure-Python driver",
      "asOf": "2026-11-17"
    },
    "F86": {
      "label": "strengths, pg8000",
      "display": "Use PostgreSQL without installing a C client-library extension.",
      "asOf": "2026-11-17"
    },
    "F87": {
      "label": "strengths lead, pg8000",
      "display": "Offers native and DB-API interfaces",
      "asOf": "2026-11-17"
    },
    "F88": {
      "label": "strengths, pg8000",
      "display": "Choose the native interface or the standardized DB-API interface.",
      "asOf": "2026-11-17"
    },
    "F89": {
      "label": "limitations lead, pg8000",
      "display": "Connections belong to one thread",
      "asOf": "2026-11-17"
    },
    "F90": {
      "label": "limitations, pg8000",
      "display": "Create separate connections for concurrent work in different threads.",
      "asOf": "2026-11-17"
    },
    "F91": {
      "label": "Quickstart, pg8000",
      "display": "import pg8000.native\n\n# Connect to the database with user name postgres\n\ncon = pg8000.native.Connection(\"postgres\", password=\"cpsnow\")\n\n# Create a temporary table\n\ncon.run(\"CREATE TEMPORARY TABLE book (id SERIAL, title TEXT)\")\n\n# Populate the table\n\nfor title in (\"Ender's Game\", \"The Magus\"):\n    con.run(\"INSERT INTO book (title) VALUES (:title)\", title=title)\n\n# Print all the rows in the table\n\nfor row in con.run(\"SELECT * FROM book\"):\n    print(row)\n\ncon.close()\n",
      "asOf": "2026-11-17"
    },
    "F92": {
      "label": "Quickstart source reference, pg8000",
      "display": "pg8000.native.Connection()",
      "asOf": "2026-11-17"
    },
    "F93": {
      "label": "Project function, pg8000",
      "display": "def set_isolation_level(self, dbapi_connection, level):\n    level = level.replace(\"_\", \" \")\n\n    if level == \"AUTOCOMMIT\":\n        dbapi_connection.autocommit = True\n    else:\n        dbapi_connection.autocommit = False\n        cursor = dbapi_connection.cursor()\n        cursor.execute(\n            \"SET SESSION CHARACTERISTICS AS TRANSACTION \"\n            f\"ISOLATION LEVEL {level}\"\n        )\n        cursor.execute(\"COMMIT\")\n        cursor.close()\n",
      "asOf": "2026-11-17"
    },
    "F94": {
      "label": "Project function reference, pg8000",
      "display": "pg8000.py · set_isolation_level()",
      "asOf": "2026-11-17"
    },
    "F95": {
      "label": "Project repository, pg8000",
      "display": "sqlalchemy/sqlalchemy",
      "asOf": "2026-11-17"
    },
    "F96": {
      "label": "Project stars, sqlalchemy/sqlalchemy",
      "display": "12.3K",
      "asOf": "2026-11-17"
    },
    "F97": {
      "label": "Project push date, sqlalchemy/sqlalchemy",
      "display": "Nov 2026",
      "asOf": "2026-11-15"
    },
    "F98": {
      "label": "Developer need",
      "display": "Similar sync and async interfaces",
      "asOf": "2026-11-17"
    },
    "F99": {
      "label": "Why choose psycopg",
      "display": "matching connection and cursor patterns",
      "asOf": "2026-11-17"
    },
    "F100": {
      "label": "Developer need in introduction",
      "display": "similar sync and async interfaces",
      "asOf": "2026-11-17"
    },
    "F101": {
      "label": "When to consider asyncpg",
      "display": "an asyncio application wants a built-in connection pool",
      "asOf": "2026-11-17"
    },
    "F102": {
      "label": "Developer need",
      "display": "Existing libpq-backed integrations",
      "asOf": "2026-11-17"
    },
    "F103": {
      "label": "Why choose psycopg2-binary",
      "display": "the established Psycopg adapter",
      "asOf": "2026-11-17"
    },
    "F104": {
      "label": "Developer need in introduction",
      "display": "existing libpq-backed integrations",
      "asOf": "2026-11-17"
    },
    "F105": {
      "label": "When to consider psycopg",
      "display": "new code needs native async-await interfaces",
      "asOf": "2026-11-17"
    },
    "F106": {
      "label": "Developer need",
      "display": "Asyncio with built-in pooling",
      "asOf": "2026-11-17"
    },
    "F107": {
      "label": "Why choose asyncpg",
      "display": "an asynchronous connection pool",
      "asOf": "2026-11-17"
    },
    "F108": {
      "label": "Developer need in introduction",
      "display": "asyncio with built-in pooling",
      "asOf": "2026-11-17"
    },
    "F109": {
      "label": "Developer need",
      "display": "Pure-Python PostgreSQL connections",
      "asOf": "2026-11-17"
    },
    "F110": {
      "label": "Why choose pg8000",
      "display": "a pure-Python driver",
      "asOf": "2026-11-17"
    },
    "F111": {
      "label": "Developer need in introduction",
      "display": "pure-Python PostgreSQL connections",
      "asOf": "2026-11-17"
    },
    "F112": {
      "label": "When to consider psycopg2-binary",
      "display": "the integration needs libpq-backed behavior",
      "asOf": "2026-11-17"
    },
    "F113": {
      "label": "Page introduction",
      "display": "Python PostgreSQL libraries let application developers connect to PostgreSQL and execute queries.",
      "asOf": "2026-11-17"
    },
    "F114": {
      "label": "FAQ: What is the best Python PostgreSQL library?",
      "display": "Choose Psycopg for similar synchronous and asynchronous interfaces.",
      "asOf": "2026-11-17"
    },
    "F115": {
      "label": "FAQ: What is the best Python PostgreSQL library?",
      "display": "asyncpg includes an asynchronous connection pool.",
      "asOf": "2026-11-17"
    },
    "F116": {
      "label": "FAQ: What is the best Python PostgreSQL library?",
      "display": "pg8000 is a pure-Python driver.",
      "asOf": "2026-11-17"
    },
    "F117": {
      "label": "FAQ: What is the best Python PostgreSQL library?",
      "display": "Existing Psycopg integrations can use the libpq-backed Psycopg 2 adapter.",
      "asOf": "2026-11-17"
    },
    "F118": {
      "label": "FAQ: How do the Psycopg generations differ in async support?",
      "display": "Psycopg 3 exposes asynchronous objects with await-based usage.",
      "asOf": "2026-11-17"
    },
    "F119": {
      "label": "FAQ: How do the Psycopg generations differ in async support?",
      "display": "Psycopg 2 asynchronous connections require the caller to poll the socket.",
      "asOf": "2026-11-17"
    },
    "F120": {
      "label": "FAQ: Which Python PostgreSQL drivers include connection pooling?",
      "display": "Psycopg 2 includes simple and threaded pool classes.",
      "asOf": "2026-11-17"
    },
    "F121": {
      "label": "FAQ: Which Python PostgreSQL drivers include connection pooling?",
      "display": "asyncpg includes a connection pool.",
      "asOf": "2026-11-17"
    },
    "F122": {
      "label": "FAQ: Which Python PostgreSQL drivers include connection pooling?",
      "display": "Psycopg 3 distributes its pool classes in a separate package.",
      "asOf": "2026-11-17"
    },
    "F123": {
      "label": "FAQ: Can I stream PostgreSQL COPY data from Python?",
      "display": "Psycopg provides COPY protocol APIs.",
      "asOf": "2026-11-17"
    },
    "F124": {
      "label": "FAQ: Can I stream PostgreSQL COPY data from Python?",
      "display": "asyncpg copies query results to files or file-like objects.",
      "asOf": "2026-11-17"
    },
    "F125": {
      "label": "FAQ: Can I stream PostgreSQL COPY data from Python?",
      "display": "pg8000 copies data from and to streams, including CSV.",
      "asOf": "2026-11-17"
    },
    "F126": {
      "label": "FAQ: Why do asyncpg prepared statement objects stop working after pool release?",
      "display": "Prepared-statement and cursor objects become invalid when their connection is released.",
      "asOf": "2026-11-17"
    },
    "F127": {
      "label": "FAQ: Can pg8000 connections be shared between threads?",
      "display": "pg8000 allows threads to share the module, while each connection stays with its owning thread.",
      "asOf": "2026-11-17"
    },
    "F128": {
      "label": "FAQ: Does upgrading system OpenSSL update the Psycopg binary wheel?",
      "display": "The wheel includes its own libssl and libpq; system-library updates do not replace those bundled copies.",
      "asOf": "2026-11-17"
    },
    "F129": {
      "label": "Library name, psycopg2-binary",
      "display": "psycopg2",
      "asOf": "2026-11-20"
    },
    "F130": {
      "label": "Monthly downloads, psycopg2-binary",
      "display": "239.0M",
      "asOf": "2026-11-20"
    },
    "F131": {
      "label": "License, psycopg2-binary",
      "display": "LGPL with exceptions",
      "asOf": "2026-11-20"
    },
    "F132": {
      "label": "Package release, psycopg2-binary",
      "display": "2.9.13",
      "asOf": "2026-11-20"
    },
    "F133": {
      "label": "Package release date, psycopg2-binary",
      "display": "Sep 2026",
      "asOf": "2026-11-20"
    },
    "F134": {
      "label": "Install, psycopg2-binary",
      "display": "python3 -m pip install psycopg2-binary",
      "asOf": "2026-11-20"
    },
    "F135": {
      "label": "Quickstart, psycopg2-binary",
      "display": "import psycopg2\nconn = psycopg2.connect(\"dbname=test user=postgres\")\ncur = conn.cursor()\ncur.execute(\"SELECT 1\")\nprint(cur.fetchone())\ncur.close()\nconn.close()\n",
      "asOf": "2026-11-20"
    },
    "F136": {
      "label": "Repository stars, psycopg2-binary",
      "display": "3.7K",
      "asOf": "2026-11-20"
    },
    "F137": {
      "label": "Async query API, psycopg2-binary",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F138": {
      "label": "Sync query API, psycopg2-binary",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F139": {
      "label": "Interface and workload, psycopg2-binary",
      "display": "Established synchronous libpq adapter for existing psycopg2 integrations; publisher directs new projects toward Psycopg3.",
      "asOf": "2026-11-20"
    },
    "F140": {
      "label": "Download scope, psycopg2-binary",
      "display": "Selected distribution installations, including dependency overlap. Source/binary and companion/backend counts are not summed and do not prove distinct PostgreSQL developers.",
      "asOf": "2026-11-20"
    },
    "F141": {
      "label": "New-project guidance, psycopg2-binary",
      "display": "Official publisher says new projects should probably start from Psycopg3; current2.x is maintained but is not expected to receive new features.",
      "asOf": "2026-11-20"
    },
    "F142": {
      "label": "Project function, psycopg2-binary",
      "display": "@async_unsafe\ndef get_new_connection(self, conn_params):\n    # self.isolation_level must be set:\n    # - after connecting to the database in order to obtain the database's\n    #   default when no value is explicitly specified in options.\n    # - before calling _set_autocommit() because if autocommit is on, that\n    #   will set connection.isolation_level to ISOLATION_LEVEL_AUTOCOMMIT.\n    options = self.settings_dict[\"OPTIONS\"]\n    set_isolation_level = False\n    try:\n        isolation_level_value = options[\"isolation_level\"]\n    except KeyError:\n        self.isolation_level = IsolationLevel.READ_COMMITTED\n    else:\n        # Set the isolation level to the value from OPTIONS.\n        try:\n            self.isolation_level = IsolationLevel(isolation_level_value)\n            set_isolation_level = True\n        except ValueError:\n            raise ImproperlyConfigured(\n                f\"Invalid transaction isolation level {isolation_level_value} \"\n                f\"specified. Use one of the psycopg.IsolationLevel values.\"\n            )\n    if self.pool:\n        # If nothing else has opened the pool, open it now.\n        self.pool.open()\n        connection = self.pool.getconn()\n    else:\n        connection = self.Database.connect(**conn_params)\n    if set_isolation_level:\n        connection.isolation_level = self.isolation_level\n    if not is_psycopg3:\n        # Register dummy loads() to avoid a round trip from psycopg2's\n        # decode to json.dumps() to json.loads(), when using a custom\n        # decoder in JSONField.\n        psycopg2.extras.register_default_jsonb(\n            conn_or_curs=connection, loads=lambda x: x\n        )\n    return connection\n",
      "asOf": "2026-11-20"
    },
    "F143": {
      "label": "Project source file, psycopg2-binary",
      "display": "django/db/backends/postgresql/base.py",
      "asOf": "2026-11-20"
    },
    "F144": {
      "label": "Project full_name, psycopg2-binary",
      "display": "django/django",
      "asOf": "2026-11-20"
    },
    "F145": {
      "label": "Project stargazers_count, psycopg2-binary",
      "display": "91.8K",
      "asOf": "2026-11-20"
    },
    "F146": {
      "label": "Library name, psycopg",
      "display": "Psycopg",
      "asOf": "2026-11-20"
    },
    "F147": {
      "label": "Monthly downloads, psycopg",
      "display": "216.8M",
      "asOf": "2026-11-20"
    },
    "F148": {
      "label": "License, psycopg",
      "display": "LGPL-3.0-only",
      "asOf": "2026-11-20"
    },
    "F149": {
      "label": "Package release, psycopg",
      "display": "3.3.9",
      "asOf": "2026-11-20"
    },
    "F150": {
      "label": "Package release date, psycopg",
      "display": "Nov 2026",
      "asOf": "2026-11-20"
    },
    "F151": {
      "label": "Install, psycopg",
      "display": "python3 -m pip install \"psycopg[binary]\"",
      "asOf": "2026-11-20"
    },
    "F152": {
      "label": "Quickstart, psycopg",
      "display": "import psycopg\nwith psycopg.connect(\"dbname=test user=postgres\") as conn:\n    print(conn.execute(\"SELECT 1\").fetchone())\n",
      "asOf": "2026-11-20"
    },
    "F153": {
      "label": "Repository stars, psycopg",
      "display": "2.5K",
      "asOf": "2026-11-20"
    },
    "F154": {
      "label": "Async query API, psycopg",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F155": {
      "label": "Sync query API, psycopg",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F156": {
      "label": "Interface and workload, psycopg",
      "display": "Current Psycopg generation with comparable synchronous and native async interfaces; official publisher recommends it for new work.",
      "asOf": "2026-11-20"
    },
    "F157": {
      "label": "Download scope, psycopg",
      "display": "Selected distribution installations, including dependency overlap. Source/binary and companion/backend counts are not summed and do not prove distinct PostgreSQL developers.",
      "asOf": "2026-11-20"
    },
    "F158": {
      "label": "Project function, psycopg",
      "display": "def execute_normal_sql(self, split_sql):\n    \"\"\"Returns tuple (title, rows, headers, status)\"\"\"\n    _logger.debug(\"Regular sql statement. sql: %r\", split_sql)\n\n    title = \"\"\n\n    def handle_notices(n):\n        nonlocal title\n        title = f\"{title}\"\n        if n.message_primary is not None:\n            title = f\"{title}\\n{n.message_primary}\"\n        if n.message_detail is not None:\n            title = f\"{title}\\n{n.message_detail}\"\n\n    self.conn.add_notice_handler(handle_notices)\n\n    if self.is_virtual_database() and \"show help\" in split_sql.lower():\n        # see https://github.com/psycopg/psycopg/issues/303\n        # special case \"show help\" in pgbouncer\n        res = self.conn.pgconn.exec_(split_sql.encode())\n        return title, None, None, res.command_status.decode()\n\n    cur = self.conn.cursor()\n    cur.execute(split_sql)\n\n    # cur.description will be None for operations that do not return\n    # rows.\n    if cur.description:\n        headers = [x[0] for x in cur.description]\n        return title, cur, headers, cur.statusmessage\n    elif cur.protocol_error:\n        _logger.debug(\"Protocol error, unsupported command.\")\n        return title, None, None, cur.protocol_message\n    else:\n        _logger.debug(\"No rows in result.\")\n        return title, None, None, cur.statusmessage\n",
      "asOf": "2026-11-20"
    },
    "F159": {
      "label": "Project source file, psycopg",
      "display": "pgcli/pgexecute.py",
      "asOf": "2026-11-20"
    },
    "F160": {
      "label": "Project full_name, psycopg",
      "display": "dbcli/pgcli",
      "asOf": "2026-11-20"
    },
    "F161": {
      "label": "Project stargazers_count, psycopg",
      "display": "13.4K",
      "asOf": "2026-11-20"
    },
    "F162": {
      "label": "Library name, asyncpg",
      "display": "asyncpg",
      "asOf": "2026-11-20"
    },
    "F163": {
      "label": "Monthly downloads, asyncpg",
      "display": "145.4M",
      "asOf": "2026-11-20"
    },
    "F164": {
      "label": "License, asyncpg",
      "display": "Apache-2.0",
      "asOf": "2026-11-20"
    },
    "F165": {
      "label": "Package release, asyncpg",
      "display": "0.32.0",
      "asOf": "2026-11-20"
    },
    "F166": {
      "label": "Package release date, asyncpg",
      "display": "Oct 2026",
      "asOf": "2026-11-20"
    },
    "F167": {
      "label": "Install, asyncpg",
      "display": "python3 -m pip install asyncpg",
      "asOf": "2026-11-20"
    },
    "F168": {
      "label": "Quickstart, asyncpg",
      "display": "import asyncio\nimport asyncpg\nasync def main():\n    conn = await asyncpg.connect(\"postgresql://postgres@localhost/test\")\n    try:\n        print(await conn.fetchval(\"SELECT 1\"))\n    finally:\n        await conn.close()\nasyncio.run(main())\n",
      "asOf": "2026-11-20"
    },
    "F169": {
      "label": "Repository stars, asyncpg",
      "display": "8.1K",
      "asOf": "2026-11-20"
    },
    "F170": {
      "label": "Async query API, asyncpg",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F171": {
      "label": "Sync query API, asyncpg",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F172": {
      "label": "Interface and workload, asyncpg",
      "display": "Dedicated asyncio PostgreSQL protocol client and pool, not a synchronous DBAPI adapter.",
      "asOf": "2026-11-20"
    },
    "F173": {
      "label": "Download scope, asyncpg",
      "display": "Selected distribution installations, including dependency overlap. Source/binary and companion/backend counts are not summed and do not prove distinct PostgreSQL developers.",
      "asOf": "2026-11-20"
    },
    "F174": {
      "label": "Project function, asyncpg",
      "display": "async def start(\n    self, is_root: bool, extra_options: typing.Dict[typing.Any, typing.Any]\n) -> None:\n    assert self._connection._connection is not None, \"Connection is not acquired\"\n    self._transaction = self._connection._connection.transaction(**extra_options)\n    await self._transaction.start()\n",
      "asOf": "2026-11-20"
    },
    "F175": {
      "label": "Project source file, asyncpg",
      "display": "databases/backends/postgres.py",
      "asOf": "2026-11-20"
    },
    "F176": {
      "label": "Project full_name, asyncpg",
      "display": "encode/databases",
      "asOf": "2026-11-20"
    },
    "F177": {
      "label": "Project stargazers_count, asyncpg",
      "display": "4.0K",
      "asOf": "2026-11-20"
    },
    "F178": {
      "label": "Library name, pg8000",
      "display": "pg8000",
      "asOf": "2026-11-20"
    },
    "F179": {
      "label": "Monthly downloads, pg8000",
      "display": "55.0M",
      "asOf": "2026-11-20"
    },
    "F180": {
      "label": "License, pg8000",
      "display": "BSD-3-Clause",
      "asOf": "2026-11-20"
    },
    "F181": {
      "label": "Package release, pg8000",
      "display": "1.31.6",
      "asOf": "2026-11-20"
    },
    "F182": {
      "label": "Package release date, pg8000",
      "display": "Oct 2026",
      "asOf": "2026-11-20"
    },
    "F183": {
      "label": "Install, pg8000",
      "display": "python3 -m pip install pg8000",
      "asOf": "2026-11-20"
    },
    "F184": {
      "label": "Quickstart, pg8000",
      "display": "import pg8000.dbapi\nconn = pg8000.dbapi.connect(user=\"postgres\", database=\"test\")\ncur = conn.cursor()\ncur.execute(\"SELECT 1\")\nprint(cur.fetchone())\ncur.close()\nconn.close()\n",
      "asOf": "2026-11-20"
    },
    "F185": {
      "label": "Async query API, pg8000",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F186": {
      "label": "Sync query API, pg8000",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F187": {
      "label": "Interface and workload, pg8000",
      "display": "Pure-Python PostgreSQL protocol driver with both DBAPI and native query interfaces; no libpq dependency.",
      "asOf": "2026-11-20"
    },
    "F188": {
      "label": "Download scope, pg8000",
      "display": "Selected distribution installations, including dependency overlap. Source/binary and companion/backend counts are not summed and do not prove distinct PostgreSQL developers.",
      "asOf": "2026-11-20"
    },
    "F189": {
      "label": "Repository host, pg8000",
      "display": "Official upstream is on Codeberg; Codeberg repository counts are retained separately and no GitHub star metric is printed.",
      "asOf": "2026-11-20"
    },
    "F190": {
      "label": "Project function, pg8000",
      "display": "def set_isolation_level(self, dbapi_connection, level):\n    level = level.replace(\"_\", \" \")\n\n    if level == \"AUTOCOMMIT\":\n        dbapi_connection.autocommit = True\n    else:\n        dbapi_connection.autocommit = False\n        cursor = dbapi_connection.cursor()\n        cursor.execute(\n            \"SET SESSION CHARACTERISTICS AS TRANSACTION \"\n            f\"ISOLATION LEVEL {level}\"\n        )\n        cursor.execute(\"COMMIT\")\n        cursor.close()\n",
      "asOf": "2026-11-20"
    },
    "F191": {
      "label": "Project source file, pg8000",
      "display": "lib/sqlalchemy/dialects/postgresql/pg8000.py",
      "asOf": "2026-11-20"
    },
    "F192": {
      "label": "Project full_name, pg8000",
      "display": "sqlalchemy/sqlalchemy",
      "asOf": "2026-11-20"
    },
    "F193": {
      "label": "Project stargazers_count, pg8000",
      "display": "12.3K",
      "asOf": "2026-11-20"
    },
    "F194": {
      "label": "Library name, connectorx",
      "display": "ConnectorX",
      "asOf": "2026-11-20"
    },
    "F195": {
      "label": "Monthly downloads, connectorx",
      "display": "1.6M",
      "asOf": "2026-11-20"
    },
    "F196": {
      "label": "License, connectorx",
      "display": "MIT",
      "asOf": "2026-11-20"
    },
    "F197": {
      "label": "Package release, connectorx",
      "display": "0.4.6",
      "asOf": "2026-11-20"
    },
    "F198": {
      "label": "Package release date, connectorx",
      "display": "Sep 2026",
      "asOf": "2026-11-20"
    },
    "F199": {
      "label": "Install, connectorx",
      "display": "python3 -m pip install connectorx pandas",
      "asOf": "2026-11-20"
    },
    "F200": {
      "label": "Quickstart, connectorx",
      "display": "import connectorx as cx\ncx.read_sql(\"postgresql://username:password@server:port/database\", \"SELECT * FROM lineitem\")\n",
      "asOf": "2026-11-20"
    },
    "F201": {
      "label": "Official description, connectorx",
      "display": "Loads data from databases into DataFrames from Rust and Python.",
      "asOf": "2026-11-20"
    },
    "F202": {
      "label": "Quickstart source file, connectorx",
      "display": "README.md",
      "asOf": "2026-11-20"
    },
    "F203": {
      "label": "Repository stars, connectorx",
      "display": "2.7K",
      "asOf": "2026-11-20"
    },
    "F204": {
      "label": "Async query API, connectorx",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F205": {
      "label": "Sync query API, connectorx",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F206": {
      "label": "Interface and workload, connectorx",
      "display": "Blocking query-to-dataframe/Arrow extraction interface implemented in Rust/Python, including partitioned reads; not a general DBAPI session/transaction interface.",
      "asOf": "2026-11-20"
    },
    "F207": {
      "label": "Download scope, connectorx",
      "display": "Selected distribution installations, including dependency overlap. Source/binary and companion/backend counts are not summed and do not prove distinct PostgreSQL developers.",
      "asOf": "2026-11-20"
    },
    "F208": {
      "label": "Project function, connectorx",
      "display": "def _read_sql_connectorx(\n    query: str | list[str],\n    connection_uri: str,\n    partition_on: str | None = None,\n    partition_range: tuple[int, int] | None = None,\n    partition_num: int | None = None,\n    protocol: str | None = None,\n    schema_overrides: SchemaDict | None = None,\n    pre_execution_query: str | list[str] | None = None,\n) -> DataFrame:\n    cx = import_optional(\"connectorx\")\n\n    if parse_version(cx.__version__) < (0, 4, 2):\n        if pre_execution_query:\n            msg = \"'pre_execution_query' is only supported in connectorx version 0.4.2 or later\"\n            raise ValueError(msg)\n        return_type = \"arrow2\"\n        pre_execution_args = {}\n    else:\n        return_type = \"arrow\"\n        pre_execution_args = {\"pre_execution_query\": pre_execution_query}\n\n    try:\n        tbl = cx.read_sql(\n            conn=connection_uri,\n            query=query,\n            return_type=return_type,\n            partition_on=partition_on,\n            partition_range=partition_range,\n            partition_num=partition_num,\n            protocol=protocol,\n            **pre_execution_args,\n        )\n    except BaseException as err:\n        # basic sanitisation of /user:pass/ credentials exposed in connectorx errs\n        errmsg = re.sub(\"://[^:]+:[^:]+@\", \"://***:***@\", str(err))\n        raise type(err)(errmsg) from err\n\n    return from_arrow(tbl, schema_overrides=schema_overrides)  # type: ignore[return-value]\n",
      "asOf": "2026-11-20"
    },
    "F209": {
      "label": "Project source file, connectorx",
      "display": "py-polars/src/polars/io/database/_utils.py",
      "asOf": "2026-11-20"
    },
    "F210": {
      "label": "Project full_name, connectorx",
      "display": "pola-rs/polars",
      "asOf": "2026-11-20"
    },
    "F211": {
      "label": "Project stargazers_count, connectorx",
      "display": "40.4K",
      "asOf": "2026-11-20"
    },
    "F212": {
      "label": "Library name, adbc-driver-postgresql",
      "display": "ADBC PostgreSQL",
      "asOf": "2026-11-20"
    },
    "F213": {
      "label": "Monthly downloads, adbc-driver-postgresql",
      "display": "1.2M",
      "asOf": "2026-11-20"
    },
    "F214": {
      "label": "License, adbc-driver-postgresql",
      "display": "Apache-2.0",
      "asOf": "2026-11-20"
    },
    "F215": {
      "label": "Package release, adbc-driver-postgresql",
      "display": "1.13.0",
      "asOf": "2026-11-20"
    },
    "F216": {
      "label": "Package release date, adbc-driver-postgresql",
      "display": "Oct 2026",
      "asOf": "2026-11-20"
    },
    "F217": {
      "label": "Install, adbc-driver-postgresql",
      "display": "python3 -m pip install adbc-driver-postgresql adbc-driver-manager pyarrow",
      "asOf": "2026-11-20"
    },
    "F218": {
      "label": "Quickstart, adbc-driver-postgresql",
      "display": "import adbc_driver_postgresql.dbapi as dbapi\nwith dbapi.connect(\"postgresql://postgres@localhost/test\") as conn:\n    with conn.cursor() as cur:\n        cur.execute(\"SELECT 1\")\n        print(cur.fetchone())\n",
      "asOf": "2026-11-20"
    },
    "F219": {
      "label": "Official description, adbc-driver-postgresql",
      "display": "Connects to PostgreSQL through an ADBC driver built on libpq.",
      "asOf": "2026-11-20"
    },
    "F220": {
      "label": "Quickstart source file, adbc-driver-postgresql",
      "display": "python/adbc_driver_postgresql/adbc_driver_postgresql/dbapi.py",
      "asOf": "2026-11-20"
    },
    "F221": {
      "label": "Repository stars, adbc-driver-postgresql",
      "display": "639",
      "asOf": "2026-11-20"
    },
    "F222": {
      "label": "Async query API, adbc-driver-postgresql",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F223": {
      "label": "Sync query API, adbc-driver-postgresql",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F224": {
      "label": "Interface and workload, adbc-driver-postgresql",
      "display": "libpq-backed Arrow Database Connectivity driver with a Python DBAPI facade and columnar/Arrow result interface; low-level and DBAPI connect factories return different types.",
      "asOf": "2026-11-20"
    },
    "F225": {
      "label": "Download scope, adbc-driver-postgresql",
      "display": "Selected distribution installations, including dependency overlap. Source/binary and companion/backend counts are not summed and do not prove distinct PostgreSQL developers.",
      "asOf": "2026-11-20"
    },
    "F226": {
      "label": "Project function, adbc-driver-postgresql",
      "display": "def _open_adbc_connection(connection_uri: str) -> Any:\n    driver_name = _get_adbc_driver_name_from_uri(connection_uri)\n    module_name = _get_adbc_module_name_from_uri(connection_uri)\n\n    # some backends require the driver name to be stripped from the URI\n    if driver_name in (\"duckdb\", \"snowflake\", \"sqlite\"):\n        connection_uri = re.sub(f\"^{driver_name}:/{{,3}}\", \"\", connection_uri)\n\n    try:\n        adbc_driver = _import_optional_adbc_driver(module_name)\n    except ModuleUpgradeRequiredError:\n        raise\n    except ModuleNotFoundError as err:\n        if (found := _find_installed_adbc_driver_for(driver_name, err)) is None:\n            raise\n        # load the driver library through the generic driver manager\n        dbapi = import_module(\"adbc_driver_manager.dbapi\")\n        library, entrypoint = found\n        return dbapi.connect(\n            driver=library,\n            entrypoint=entrypoint,\n            db_kwargs=_adbc_db_kwargs(driver_name, connection_uri),\n        )\n\n    return adbc_driver.connect(connection_uri)\n",
      "asOf": "2026-11-20"
    },
    "F227": {
      "label": "Project source file, adbc-driver-postgresql",
      "display": "py-polars/src/polars/io/database/_utils.py",
      "asOf": "2026-11-20"
    },
    "F228": {
      "label": "Project full_name, adbc-driver-postgresql",
      "display": "pola-rs/polars",
      "asOf": "2026-11-20"
    },
    "F229": {
      "label": "Project stargazers_count, adbc-driver-postgresql",
      "display": "40.4K",
      "asOf": "2026-11-20"
    },
    "F230": {
      "label": "Library name, aiopg",
      "display": "aiopg",
      "asOf": "2026-11-20"
    },
    "F231": {
      "label": "Monthly downloads, aiopg",
      "display": "685.1K",
      "asOf": "2026-11-20"
    },
    "F232": {
      "label": "License, aiopg",
      "display": "BSD",
      "asOf": "2026-11-20"
    },
    "F233": {
      "label": "Package release, aiopg",
      "display": "1.4.0",
      "asOf": "2026-11-20"
    },
    "F234": {
      "label": "Package release date, aiopg",
      "display": "Oct 2022",
      "asOf": "2026-11-20"
    },
    "F235": {
      "label": "Install, aiopg",
      "display": "python3 -m pip install aiopg",
      "asOf": "2026-11-20"
    },
    "F236": {
      "label": "Quickstart, aiopg",
      "display": "import asyncio\nimport aiopg\nasync def main():\n    async with aiopg.create_pool(\"dbname=test user=postgres host=localhost\") as pool:\n        async with pool.acquire() as conn:\n            async with conn.cursor() as cur:\n                await cur.execute(\"SELECT 1\")\n                print(await cur.fetchone())\nasyncio.run(main())\n",
      "asOf": "2026-11-20"
    },
    "F237": {
      "label": "Official description, aiopg",
      "display": "Integrates PostgreSQL with asyncio.",
      "asOf": "2026-11-20"
    },
    "F238": {
      "label": "Quickstart source file, aiopg",
      "display": "index.html",
      "asOf": "2026-11-20"
    },
    "F239": {
      "label": "Repository stars, aiopg",
      "display": "1.4K",
      "asOf": "2026-11-20"
    },
    "F240": {
      "label": "Async query API, aiopg",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F241": {
      "label": "Sync query API, aiopg",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F242": {
      "label": "Interface and workload, aiopg",
      "display": "Asyncio integration over psycopg2 with coroutine connection/cursor and async pool interfaces; useful for that specific existing stack.",
      "asOf": "2026-11-20"
    },
    "F243": {
      "label": "Download scope, aiopg",
      "display": "Selected distribution installations, including dependency overlap. Source/binary and companion/backend counts are not summed and do not prove distinct PostgreSQL developers.",
      "asOf": "2026-11-20"
    },
    "F244": {
      "label": "Transaction control, aiopg",
      "display": "Uses psycopg2 asynchronous connections; connection transaction helpers have documented restrictions and cursor-level transaction control must follow aiopg guidance.",
      "asOf": "2026-11-20"
    },
    "F245": {
      "label": "Project function, aiopg",
      "display": "async def pg_context(app):\n    conf = app['config']['postgres']\n    engine = await aiopg.sa.create_engine(\n        database=conf['database'],\n        user=conf['user'],\n        password=conf['password'],\n        host=conf['host'],\n        port=conf['port'],\n        minsize=conf['minsize'],\n        maxsize=conf['maxsize'],\n    )\n    app['db'] = engine\n\n    yield\n\n    app['db'].close()\n    await app['db'].wait_closed()\n",
      "asOf": "2026-11-20"
    },
    "F246": {
      "label": "Project source file, aiopg",
      "display": "demos/polls/aiohttpdemo_polls/db.py",
      "asOf": "2026-11-20"
    },
    "F247": {
      "label": "Project full_name, aiopg",
      "display": "aio-libs/aiohttp-demos",
      "asOf": "2026-11-20"
    },
    "F248": {
      "label": "Project stargazers_count, aiopg",
      "display": "749",
      "asOf": "2026-11-20"
    },
    "F249": {
      "label": "Library name, pygresql",
      "display": "PyGreSQL",
      "asOf": "2026-11-20"
    },
    "F250": {
      "label": "Monthly downloads, pygresql",
      "display": "339.5K",
      "asOf": "2026-11-20"
    },
    "F251": {
      "label": "License, pygresql",
      "display": "PostgreSQL",
      "asOf": "2026-11-20"
    },
    "F252": {
      "label": "Package release, pygresql",
      "display": "6.2.3",
      "asOf": "2026-11-20"
    },
    "F253": {
      "label": "Package release date, pygresql",
      "display": "Jan 2026",
      "asOf": "2026-11-20"
    },
    "F254": {
      "label": "Install, pygresql",
      "display": "python3 -m pip install pygresql",
      "asOf": "2026-11-20"
    },
    "F255": {
      "label": "Quickstart, pygresql",
      "display": "import pgdb\nconn = pgdb.connect(database=\"test\", user=\"postgres\")\ncur = conn.cursor()\ncur.execute(\"SELECT 1\")\nprint(cur.fetchone())\ncur.close()\nconn.close()\n",
      "asOf": "2026-11-20"
    },
    "F256": {
      "label": "Official description, pygresql",
      "display": "Provides Python interfaces to PostgreSQL.",
      "asOf": "2026-11-20"
    },
    "F257": {
      "label": "Quickstart source file, pygresql",
      "display": "contents/pgdb/module.html",
      "asOf": "2026-11-20"
    },
    "F258": {
      "label": "Repository stars, pygresql",
      "display": "48",
      "asOf": "2026-11-20"
    },
    "F259": {
      "label": "Async query API, pygresql",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F260": {
      "label": "Sync query API, pygresql",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F261": {
      "label": "Interface and workload, pygresql",
      "display": "libpq-based PostgreSQL interfaces including DBAPI pgdb and classic pg; one distribution, not duplicate rows for its two modules.",
      "asOf": "2026-11-20"
    },
    "F262": {
      "label": "Download scope, pygresql",
      "display": "Selected distribution installations, including dependency overlap. Source/binary and companion/backend counts are not summed and do not prove distinct PostgreSQL developers.",
      "asOf": "2026-11-20"
    },
    "F263": {
      "label": "Project function, pygresql",
      "display": "def makeConnection(self):\n    try:\n        if self.driver in ('odbc', 'pyodbc', 'pypyodbc'):\n            self.debugWriter.write(\n                \"ODBC connect string: \" + self.odbc_conn_str)\n            conn = self.module.connect(self.odbc_conn_str)\n        elif self.use_dsn:\n            conn = self.module.connect(self.dsn)\n        else:\n            conn = self.module.connect(**self.dsn_dict)\n    except self.module.OperationalError as e:\n        raise dberrors.OperationalError(\n            ErrorMessage(e, \"used connection string %r\" % self.dsn))\n\n    # For printDebug in _executeRetry\n    self._connectionNumbers[id(conn)] = self._connectionCount\n\n    if self.autoCommit:\n        self._setAutoCommit(conn, 1)\n    c = conn.cursor()\n    if self.schema:\n        self._executeRetry(conn, c, \"SET search_path TO \" + self.schema)\n    dbEncoding = self.dbEncoding\n    if dbEncoding:\n        if self.driver in ('odbc', 'pyodbc'):\n            conn.setdecoding(self.module.SQL_CHAR, encoding=dbEncoding)\n            conn.setdecoding(self.module.SQL_WCHAR, encoding=dbEncoding)\n            if PY2:\n                conn.setencoding(str, encoding=dbEncoding)\n                conn.setencoding(unicode, encoding=dbEncoding)  # noqa\n            else:\n                conn.setencoding(encoding=dbEncoding)\n        self._executeRetry(conn, c,\n                           \"SET client_encoding TO '%s'\" % dbEncoding)\n    c.close()\n    return conn\n",
      "asOf": "2026-11-20"
    },
    "F264": {
      "label": "Project source file, pygresql",
      "display": "sqlobject/postgres/pgconnection.py",
      "asOf": "2026-11-20"
    },
    "F265": {
      "label": "Project full_name, pygresql",
      "display": "sqlobject/sqlobject",
      "asOf": "2026-11-20"
    },
    "F266": {
      "label": "Project stargazers_count, pygresql",
      "display": "157",
      "asOf": "2026-11-20"
    }
  },
  "dataCheckedAt": "2026-11-20",
  "agent": {
    "exaCall": {
      "endpoint": "/search",
      "body": {
        "query": "Best Python PostgreSQL libraries Psycopg psycopg2 asyncpg pg8000 drivers async connection pooling COPY code examples",
        "numResults": 5
      },
      "docsUrl": "https://exa.ai/docs/reference/search"
    },
    "calls": []
  }
}
