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 conn.cursor() as curs:
|
||||
curs.execute(
|
||||
"""
|
||||
CREATE DATABASE %(dbname)s OWNER %(username)s
|
||||
""",
|
||||
{'dbname': Ident(dbname), 'username': Ident(username)}
|
||||
)
|
||||
conn.autocommit = True
|
||||
curs = conn.cursor()
|
||||
curs.execute(
|
||||
"""
|
||||
CREATE DATABASE %(dbname)s OWNER %(username)s
|
||||
""",
|
||||
{'dbname': Ident(dbname), 'username': Ident(username)}
|
||||
)
|
||||
|
||||
|
||||
@shared_task
|
||||
|
@ -155,10 +156,11 @@ def delete_pgsql_database(dbname):
|
|||
|
||||
"""
|
||||
with _get_connection() as conn:
|
||||
with conn.cursor() as curs:
|
||||
curs.execute(
|
||||
"""
|
||||
DROP DATABASE %(dbname)s
|
||||
""",
|
||||
{'dbname': Ident(dbname)}
|
||||
)
|
||||
conn.autocommit = True
|
||||
curs = conn.cursor()
|
||||
curs.execute(
|
||||
"""
|
||||
DROP DATABASE %(dbname)s
|
||||
""",
|
||||
{'dbname': Ident(dbname)}
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue