The Python Oracle

postgres - cannot drop database using psycopg2

--------------------------------------------------
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Hypnotic Puzzle4

--

Chapters
00:00 Postgres - Cannot Drop Database Using Psycopg2
01:55 Accepted Answer Score 5
02:16 Thank you

--

Full question
https://stackoverflow.com/questions/2235...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#python #database #django #postgresql #psycopg2

#avk47



ACCEPTED ANSWER

Score 5


Here is what happened. One of the imported classes had a decorator that was opening the connection. This is a standard Django decorator transaction.atomic (I actually incorrectly applied it to a class as opposed to a method). Apparently it is executed during the import process, opening a connection to the postgres DB.