Modify

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#13646 closed defect (fixed)

Please support Postgres

Reported by: Massimo Owned by: Ryan J Ollos
Priority: normal Component: SqlQueryMacro
Severity: normal Keywords: Postgres
Cc: Trac Release: 1.2

Description

This is Trac 1.2.3

We installed SqlQueryMacro with a local version of pymills:

$ pip2.7 install --user pymills
Requirement already satisfied: pymills in /mnt/data/trac/.local/lib64/python2.7/site-packages (3.4.2)

Our database is Postgres as this is the Trac default. How can it be that the plugin does not support postgres URIs like:

[sqlquery]
uri = postgres://foo:foopass@/trac-pp

Attachments (0)

Change History (7)

comment:1 Changed 5 years ago by Ryan J Ollos

WikiTableMacro is probably a better choice.

comment:2 Changed 5 years ago by Ryan J Ollos

In 17554:

TracSqlQueryMacro 0.2: Use Trac's database API when querying Trac database

Refs #13646.

comment:3 Changed 5 years ago by Ryan J Ollos

Resolution: fixed
Status: newclosed

Plugin name has changed:

$ pip2.7 uninstall SqlQuery
$ pip2.7 install svn+https://trac-hacks.org/browser/sqlquerymacro/1.0

comment:4 Changed 5 years ago by Massimo

Thanks for the update. But postgres access is still failing:

2019-11-14 14:12:35,200 Trac[formatter] DEBUG: Executing Wiki macro SQLTable by provider <Component wikitable.table.SQLTable>
2019-11-14 14:12:35,268 Trac[formatter] DEBUG: Executing Wiki macro SQL by provider <Component sqlquery.macro.SqlQueryMacro>
2019-11-14 14:12:35,270 Trac[formatter] ERROR: Processor SQL failed for <Resource u'wiki:Users/test/SqlWikis'>:
Traceback (most recent call last):
  File "/mnt/data/trac/.local/lib64/python2.7/site-packages/trac/wiki/formatter.py", line 1222, in _exec_processor
    return processor.process(text)
  File "/mnt/data/trac/.local/lib64/python2.7/site-packages/trac/wiki/formatter.py", line 389, in process
    text = self.processor(text)
  File "/mnt/data/trac/.local/lib64/python2.7/site-packages/trac/wiki/formatter.py", line 361, in _macro_processor
    text)
  File "build/bdist.linux-x86_64/egg/sqlquery/macro.py", line 53, in expand_macro
    db = Connection(self.uri)
  File "/mnt/data/trac/.local/lib64/python2.7/site-packages/pymills/dbapi.py", line 55, in create_connection
    return types[type](*args, **kwargs)
KeyError: u'postgres://foo:foopass@/trac-pp'

comment:5 Changed 5 years ago by Ryan J Ollos

Please remove the [sqlquery] uri option from your trac.ini.

comment:7 Changed 5 years ago by Massimo

No matter which statement, the macro is failing. I tried with this simple statement:

{{{#!SQL
SELECT * FROM ticket_custom
}}}
2019-11-15 08:06:07,591 Trac[formatter] DEBUG: Executing Wiki macro SQLTable by provider <Component wikitable.table.SQLTable>
2019-11-15 08:06:07,594 Trac[formatter] DEBUG: Executing Wiki macro SQLTable by provider <Component wikitable.table.SQLTable>
2019-11-15 08:06:07,668 Trac[formatter] DEBUG: Executing Wiki macro SQL by provider <Component sqlquery.macro.SqlQueryMacro>
2019-11-15 08:06:07,686 Trac[formatter] ERROR: Processor SQL failed for <Resource u'wiki:Users/test/SqlWikis'>:
Traceback (most recent call last):
  File "/mnt/data/trac/.local/lib64/python2.7/site-packages/trac/wiki/formatter.py", line 1222, in _exec_processor
    return processor.process(text)
  File "/mnt/data/trac/.local/lib64/python2.7/site-packages/trac/wiki/formatter.py", line 389, in process
    text = self.processor(text)
  File "/mnt/data/trac/.local/lib64/python2.7/site-packages/trac/wiki/formatter.py", line 361, in _macro_processor
    text)
  File "build/bdist.linux-x86_64/egg/sqlquery/macro.py", line 65, in expand_macro
    records = cursor.execute(sql).fetchall()
AttributeError: 'NoneType' object has no attribute 'fetchall'

comment:8 Changed 5 years ago by Ryan J Ollos

In 17555:

TracSqlQueryMacro 0.2: Fix incorrectly chained methods

Refs #13646.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ryan J Ollos.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


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

 
Note: See TracTickets for help on using tickets.