Reputation: 14335
I'm using Django with postgresql database.
I'm having very limited access for database configuration and can't alter postgresql.conf
.
However if I want to execute all queries through django with specified statement_mem
settings say 10MB.
I tried using cursor.execute("set statement_mem='10MB'")
- it is working but how can I write it in generic way - so each every API calls go using by this setting?
Upvotes: 0
Views: 508
Reputation: 5715
Wrap the cursor in your own class that executes cursor.execute("set statement_mem='10MB'")
on every call but otherwise mimics the cursor class. You could "monkeypatch" the real cursor class too, but this could be confusing.
Upvotes: 1