Comment (by Carlton Gibson):
#32589 was a duplicate ref documenting the need for calling
close_old_connections in long-running management commands.
Ostensibly this ticket here is about connection creation, but (a decade
later) a general overview of the connection life-cycle would be a nice
improvement.
--
Ticket URL: <https://code.djangoproject.com/ticket/14845#comment:11>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* cc: GwynBleidD (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/14845#comment:12>
Comment (by dcontador):
Whoever takes this should remember to document `close_old_connections`
([https://code.djangoproject.com/ticket/32589]).
--
Ticket URL: <https://code.djangoproject.com/ticket/14845#comment:13>
* status: new => assigned
* cc: Akshat verma (added)
* needs_better_patch: 0 => 1
* easy: 0 => 1
* owner: nobody => Akshat verma
* needs_docs: 0 => 1
* has_patch: 0 => 1
* ui_ux: 0 => 1
Old description:
> Currently, the actual database connection is created on-demand when a
> cursor is requested. This is great for standard use, but there are
> occasional uses where it would be handy to have the connection open
> before requesting a cursor (for example, if you are doing a raw SQL query
> using the cursor(cursor_factory=) syntax.
>
> The proposal here is to move the connection-creation mechanism to a
> separate public method that both the internal cursor-creation mechanism
> and a client of the connection object could call.
New description:
Currently, the actual database connection is created on-demand when a
cursor is requested. This is great for standard use, but there are
occasional uses where it would be handy to have the connection open before
requesting a cursor (for example, if you are doing a raw SQL query using
the cursor(cursor_factory=) syntax.
The proposal here is to move the connection-creation mechanism to a
separate public method that both the internal cursor-creation mechanism
and a client of the connection object could call.
# in settings.py
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'OPTIONS': {
'service': 'my_service',
'passfile': '.my_pgpass',
},
}
}
#in .pg_service.conf
[my_service]
host=localhost
user=USER
dbname=NAME
port=5432
#in .my_pgpass
localhost:5432:NAME:USER:PASSWORD
--
Comment:
#changes by Akshat verma
# in settings.py
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'OPTIONS': {
'service': 'my_service',
'passfile': '.my_pgpass',
},
}
}
#in .pg_service.conf
[my_service]
host=localhost
user=USER
dbname=NAME
port=5432
#in .my_pgpass
localhost:5432:NAME:USER:PASSWORD
--
Ticket URL: <https://code.djangoproject.com/ticket/14845#comment:14>
Comment (by Mariusz Felisiak):
Akshat, again, please stop to change ticket descriptions and put random
information that is neither helpful nor related with the ticket.
Comment (by Akshat verma):
Replying to [comment:14 Mariusz Felisiak]:
> Okay but I unable to get your comments. And due to lack of some
information I did so
And one thing I want to say that the changes commit by me was quite
genuine but I the place I made was wrong so you must suggest me the rigth
file path in the GitHub repository.
--
Ticket URL: <https://code.djangoproject.com/ticket/14845#comment:15>
* owner: nobody => Akshat verma
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/14845#comment:16>
Comment (by Mariusz Felisiak):
Replying to [comment:15 Akshat verma]:
> Replying to [comment:14 Mariusz Felisiak]:
> > Okay but I unable to get your comments. And due to lack of some
information I did so
> And one thing I want to say that the changes commit by me was quite
genuine but I the place I made was wrong so you must suggest me the right
file path in the GitHub repository.
Please don't edit my comments, you're behavior is really inappropriate. I
left at least a few comments with gentle requests before I started
cleaning up after you. If you want to contribute and need help you should
start from [https://docs.djangoproject.com/en/4.2/internals/contributing/
reading docs] and eventually asking questions on
[https://code.djangoproject.com/wiki/TicketClosingReasons/UseSupportChannels
support channels]. Are you really going to work on 10 tickets at once?
Again, I'd recommend picking one ticket and starting with that.
--
Ticket URL: <https://code.djangoproject.com/ticket/14845#comment:17>
* owner: nobody => Pradhvan Bisht
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/14845#comment:14>