avoid transaction for CREATE and DROP database
This commit is contained in:
parent
0b1249ed5d
commit
0ddf72b323
1 changed files with 16 additions and 14 deletions
|
@ -135,13 +135,14 @@ def create_pgsql_database(dbname, username):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
with _get_connection() as conn:
|
with _get_connection() as conn:
|
||||||
with conn.cursor() as curs:
|
conn.autocommit = True
|
||||||
curs.execute(
|
curs = conn.cursor()
|
||||||
"""
|
curs.execute(
|
||||||
CREATE DATABASE %(dbname)s OWNER %(username)s
|
"""
|
||||||
""",
|
CREATE DATABASE %(dbname)s OWNER %(username)s
|
||||||
{'dbname': Ident(dbname), 'username': Ident(username)}
|
""",
|
||||||
)
|
{'dbname': Ident(dbname), 'username': Ident(username)}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@shared_task
|
@shared_task
|
||||||
|
@ -155,10 +156,11 @@ def delete_pgsql_database(dbname):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
with _get_connection() as conn:
|
with _get_connection() as conn:
|
||||||
with conn.cursor() as curs:
|
conn.autocommit = True
|
||||||
curs.execute(
|
curs = conn.cursor()
|
||||||
"""
|
curs.execute(
|
||||||
DROP DATABASE %(dbname)s
|
"""
|
||||||
""",
|
DROP DATABASE %(dbname)s
|
||||||
{'dbname': Ident(dbname)}
|
""",
|
||||||
)
|
{'dbname': Ident(dbname)}
|
||||||
|
)
|
||||||
|
|
Loading…
Reference in a new issue