Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#1631 closed enhancement (fixed)

[patch] dbclient: execute psql/mysql/sqlite3 client using project's DB settings

Reported by: pb@… Owned by: Adrian Holovaty
Component: Database layer (models, ORM) Version: magic-removal
Severity: trivial Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


OK, so I'm just scratching my own itch with this patch but I'm hoping others find it useful. If it needs to be kicked to the mailing list for more discussion that's fine.

It adds a command, dbclient (or dbclient) that launches the appropriate command-line client (psql, mysql, sqlite3) using DATABASE_* settings from the active settings file.

Note: I have tested this only on MySQL and SQLite back-ends -- I don't have a running PostgreSQL install, though I am fairly sure the command structure is correct. Nonetheless, testing is of course appreciated.

Attachments (1)

dbclient.patch (4.3 KB) - added by pb 12 years ago.

Download all attachments as: .zip

Change History (4)

Changed 12 years ago by pb

Attachment: dbclient.patch added


comment:1 Changed 12 years ago by Adrian Holovaty

Oooh! This is very cool, Paul! The one obvious imperfection is that it assumes the command-line clients are on the system path, but I think that's not too horrible of a requirement to use this feature.

comment:2 Changed 12 years ago by anonymous

Yeah, that seemed like an acceptable blemish to me given the alternatives. Glad you like it!

A sensible improvement would be to check for existence of the binaries before trying to invoke them, for nicer errors if nothing else. In Unix I'd do this with "which" but don't know a Windows/portable solution.

comment:3 Changed 12 years ago by Adrian Holovaty

Resolution: fixed
Status: newclosed

(In [2693]) magic-removal: Fixed #1631 -- Added ' dbshell' command, which runs the command-line client for your database engine with your connection settings. Thanks, Paul Bissex

Note: See TracTickets for help on using tickets.
Back to Top