summaryrefslogtreecommitdiffstats
path: root/docs/api/conninfo.rst
blob: 9e5b01da2bec01c49ca144887fa2d27353be83ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
.. _psycopg.conninfo:

`conninfo` -- manipulate connection strings
===========================================

This module contains a few utility functions to manipulate database
connection strings.

.. module:: psycopg.conninfo

.. autofunction:: conninfo_to_dict

   .. code:: python

       >>> conninfo_to_dict("postgres://jeff@example.com/db", user="piro")
       {'user': 'piro', 'dbname': 'db', 'host': 'example.com'}


.. autofunction:: make_conninfo

   .. code:: python

        >>> make_conninfo("dbname=db user=jeff", user="piro", port=5432)
        'dbname=db user=piro port=5432'