Edgewall Software

Ticket #5120 (new defect)

Opened 21 months ago

Last modified 13 months ago

mysql_backend should parse parameters

Reported by: anonymous Owned by: jonas
Priority: normal Milestone: 0.10.6
Component: general Version: devel
Severity: normal Keywords: mysql
Cc: dekimsey@…

Description

Currently, mysql_backend.py only passes db, user, passwd, host, and port to MySQLdb. Any additional params are discarded. This is particularly unfortunate (at least in my case) because a number of MySQL installs do not use the default socket location, yet:

mysql://user:password@domain:3306/database?unix_socket=path/to/socket

fails, even though the backend would easily accept it.

Attachments

mysql.cnf.hack.patch (1.9 KB) - added by dekimsey@… 13 months ago.
this is a patch to add parameter support to source:/trunk/trac/db/mysql_backend.py@6299

Change History

Changed 21 months ago by cboos

  • keywords mysql added
  • owner changed from cmlenz to jonas
  • component changed from trac-admin to general
  • milestone changed from 0.12 to 0.10.5

(moving to 0.10.x, along with other mysql related issues)

Changed 13 months ago by dekimsey@…

Agreed, this is actually kind of important in my opinion as I'd really prefer not to have the mysql connect information stored inside the trac.ini file. The mysql library is able to read a configuration file instead.

I implemented a bit of a hack to get the read_default_file parameter to be passed into the connect call, I might upload a patch of it if I can figure out the correct way to pass the params hash properly to the connect sub by name. (I'm not very familiar with Python, I'm a Perl person :/)

-- Danny

Changed 13 months ago by dekimsey@…

  • cc dekimsey@… added

The only issue I have run into so far in implementing this was that certain parameters cannot be left as None and must either be passed as something valid or not passed at all. Some trial and error and I've worked down which is which.

I simply push those with defined values onto the params hash and then pass that to the connect method. It works for me, I have not tested it with an older mysqldb library than the if block checks for.

-- Danny.

Changed 13 months ago by dekimsey@…

this is a patch to add parameter support to source:/trunk/trac/db/mysql_backend.py@6299

Add/Change #5120 (mysql_backend should parse parameters)

Author



Change Properties
<Author field>
Action
as new
as The resolution will be set. Next status will be 'closed'
to The owner will change from jonas. Next status will be 'new'
The owner will change from jonas to anonymous. Next status will be 'assigned'
 
Note: See TracTickets for help on using tickets.