Opened 5 years ago

Last modified 16 months ago

#14845 new New feature

Document connection-creation process

Reported by: Xof Owned by: nobody
Component: Documentation Version: master
Severity: Normal Keywords:
Cc: hv@… Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


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.

Change History (10)

comment:1 Changed 5 years ago by russellm

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

Absent of any code, it seems like a reasonable proposal.

comment:2 Changed 5 years ago by guettli

  • Cc hv@… added

comment:3 Changed 5 years ago by jaddison

  • Severity set to Normal
  • Type set to New feature

comment:4 Changed 4 years ago by aaugustin

  • UI/UX unset

Change UI/UX from NULL to False.

comment:5 Changed 4 years ago by aaugustin

  • Easy pickings unset

Change Easy pickings from NULL to False.

comment:6 Changed 2 years ago by akaariai

  • Component changed from Database layer (models, ORM) to Documentation
  • Easy pickings set

There is connection.connect() and connection.ensure_connection() methods. I don't see a reason why these couldn't be documented (that is, they seem stable enough). Documenting these (or one of these) seems like somewhat easy documentation patch.

comment:7 Changed 2 years ago by aaugustin

Anssi, we've made lots of changes in the 1.6 release cycle, and I'm not sure this is the end of the story.

The internal APIs for connection establishement still look messy to me. Just obtaining a cursor involves ten methods or so!

comment:8 Changed 2 years ago by akaariai

I agree there is more work to do. There is no need to document everything, just ensure_connection() and connect(). Actually, even .connect() isn't necessary for this ticket. Keeping connection.ensure_connection() stable doesn't seem too bad to me.

Alternative is to document that you can do cursor = connection.cursor(); cursor.close() to ensure a connection exists. But calling methods for their side-effects is a bit ugly.

comment:9 Changed 2 years ago by timo

  • Easy pickings unset
  • Version changed from 1.3-alpha to master

comment:10 Changed 16 months ago by timgraham

  • Summary changed from Refactor backend connection-creation process to Document connection-creation process
Note: See TracTickets for help on using tickets.
Back to Top