1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Python] Psycopg3 : set_isolation_level

Discussão em 'Python' iniciado por Stack, Outubro 25, 2024 às 13:12.

  1. Stack

    Stack Membro Participativo

    I'm trying to connect with psycopg: v3.1.12 to PostgreSQL and set the Isolation Level to 1.

    I've tried adding the set_isolation_level(1) found in the official Docs in both the connection and the transaction set up but it doesn't work for me.

    Any help would be appreciated.

    My connection :

    self.pg_connection = psycopg.connect(
    (
    "dbname="
    + os.environ["PG_DB"]
    + " user="
    + os.environ["PG_USER"]
    + " password="
    + os.environ["PG_PASS"]
    + " host="
    + os.environ["PG_HOST"]
    + " port="
    + os.environ["PG_PORT"]
    ),
    row_factory=dict_row,
    autocommit=False,
    )


    My Transaction :

    with self.pg_connection.transaction() as tx:
    tx.set_isolation_level(1)


    The above returns the exception :


    Exception: 'Transaction' object has no attribute 'set_isolation_level'

    Continue reading...

Compartilhe esta Página