SILENT KILLERPanel

Current Path: > > opt > cloudlinux > venv > lib64 > python3.11 > site-packages > sqlalchemy > dialects > postgresql


Operation   : Linux premium131.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
Software     : Apache
Server IP    : 162.0.232.56 | Your IP: 216.73.216.111
Domains      : 1034 Domain(s)
Permission   : [ 0755 ]

Files and Folders in: //opt/cloudlinux/venv/lib64/python3.11/site-packages/sqlalchemy/dialects/postgresql

NameTypeSizeLast ModifiedActions
__pycache__ Directory - -
__init__.py File 2461 bytes April 17 2025 13:10:58.
array.py File 11776 bytes April 17 2025 13:10:58.
base.py File 129248 bytes April 17 2025 13:10:58.
dml.py File 7790 bytes April 17 2025 13:10:58.
ext.py File 7739 bytes April 17 2025 13:10:58.
hstore.py File 12417 bytes April 17 2025 13:10:58.
json.py File 10103 bytes April 17 2025 13:10:58.
pg8000.py File 9722 bytes April 17 2025 13:10:58.
provision.py File 2008 bytes April 17 2025 13:10:58.
psycopg2.py File 37768 bytes April 17 2025 13:10:58.
psycopg2cffi.py File 1657 bytes April 17 2025 13:10:58.
pygresql.py File 8129 bytes April 17 2025 13:10:58.
pypostgresql.py File 2915 bytes April 17 2025 13:10:58.
ranges.py File 4622 bytes April 17 2025 13:10:58.
zxjdbc.py File 1415 bytes April 17 2025 13:10:58.

Reading File: //opt/cloudlinux/venv/lib64/python3.11/site-packages/sqlalchemy/dialects/postgresql/provision.py

import time

from ... import exc
from ... import text
from ...testing.provision import create_db
from ...testing.provision import drop_db
from ...testing.provision import log
from ...testing.provision import temp_table_keyword_args


@create_db.for_db("postgresql")
def _pg_create_db(cfg, eng, ident):
    template_db = cfg.options.postgresql_templatedb

    with eng.connect().execution_options(isolation_level="AUTOCOMMIT") as conn:
        try:
            _pg_drop_db(cfg, conn, ident)
        except Exception:
            pass
        if not template_db:
            template_db = conn.scalar("select current_database()")

        attempt = 0
        while True:
            try:
                conn.execute(
                    "CREATE DATABASE %s TEMPLATE %s" % (ident, template_db)
                )
            except exc.OperationalError as err:
                attempt += 1
                if attempt >= 3:
                    raise
                if "accessed by other users" in str(err):
                    log.info(
                        "Waiting to create %s, URI %r, "
                        "template DB %s is in use sleeping for .5",
                        ident,
                        eng.url,
                        template_db,
                    )
                    time.sleep(0.5)
            except:
                raise
            else:
                break


@drop_db.for_db("postgresql")
def _pg_drop_db(cfg, eng, ident):
    with eng.connect().execution_options(isolation_level="AUTOCOMMIT") as conn:
        conn.execute(
            text(
                "select pg_terminate_backend(pid) from pg_stat_activity "
                "where usename=current_user and pid != pg_backend_pid() "
                "and datname=:dname"
            ),
            dname=ident,
        )
        conn.execute("DROP DATABASE %s" % ident)


@temp_table_keyword_args.for_db("postgresql")
def _postgresql_temp_table_keyword_args(cfg, eng):
    return {"prefixes": ["TEMPORARY"]}

SILENT KILLER Tool