I'm unfamiliar with psycopg2 so I can only provide steps to be performed.
Steps to be taken to perform DROP DATABASE
from Python:
- Connect to a different database, which you don't want to drop
- Store current isolation level in a variable
- Set isolation level to 0
- Execute
DROP DATABASE
query
- Set isolation level back to original (from #2)
Steps to be taken to perform DROP DATABASE
from PSQL:
- Connect to a different database, which you don't want to drop
- Execute
DROP DATABASE
query
Code in psql
c second_db
DROP DATABASE first_db;
Remember, that there can be no live connections to the database you are trying to drop.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…