Opened 5 years ago

Last modified 5 years ago

#12023 new defect

I can't connect to MySQL database

Reported by: paresh138@… Owned by: Ryan J Ollos
Priority: normal Component: SqlQueryMacro
Severity: normal Keywords:
Cc: Trac Release: 1.0



I managed to get this to build with pymills v3.4.2 by chnaging the line from pymills.db import Connections to from pymills.dbapi import Connections

now it seems tp load in trac 1.0.

Now I want to know how to get data from the database.

When I use the trac ticket table, I get an error with the connection string.

To try this, I have the macro enabled and have this setting: uri = mysql://mytracuser:mytracpassword@localhost/trac

This is the same connection I use for this instance of trac database = mysql://mytracuser:mytracpassword@localhost/trac

so, when a page with the macro [[SQL(SELECT * FROM ticket)]] renders, I get this error:

Error: Macro SQL(SELECT * FROM ticket) failed


The stack trace in the log file is

2014-10-19 19:55:55,799 Trac[formatter] DEBUG: Executing Wiki macro SQL by provider <sqlquery.macro.SqlQueryMacro object at 0x7f7e2ca556d0>
2014-10-19 19:55:55,799 Trac[formatter] ERROR: Macro SQL(SELECT * FROM ticket) failed:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/Trac-1.0-py2.7.egg/trac/wiki/", line 765, in _macro_formatter
return macro.ensure_inline(macro.process(args))
File "/usr/local/lib/python2.7/dist-packages/Trac-1.0-py2.7.egg/trac/wiki/", line 356, in process
text = self.processor(text)
File "/usr/local/lib/python2.7/dist-packages/Trac-1.0-py2.7.egg/trac/wiki/", line 343, in _macro_processor
File "build/bdist.linux-x86_64/egg/sqlquery/", line 46, in expand_macro
db = Connection(self.uri)
File "/usr/local/lib/python2.7/dist-packages/pymills-3.4.2-py2.7.egg/pymills/", line 55, in create_connection
return types[type](*args, **kwargs)
KeyError: u'mysql://mytracuser:mytracuser@localhost/trac'

Attachments (0)

Change History (2)

comment:1 Changed 5 years ago by Ryan J Ollos

In 14239:

Import of Connection fails, at least in the most recent version of pymills. Refs #12023.

Patch by paresh138@….

comment:2 Changed 5 years ago by Ryan J Ollos

More work is needed after [14239], that was just a start. We should probably remove the dependency on PyMills.

Modify Ticket

Change Properties
Set your email in Preferences
as new The owner will remain Ryan J Ollos.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.