Mailing List Archive

SqlQueryMacro failed with SQLite
Hello

I struggling with the SqlQueryMacro.

https://trac-hacks.org/wiki/SqlQueryMacro

What I want is to query a SQLite database of another TRAC instance (on
the same server).

I have this example query in my wiki:

[[SQL(SELECT * FROM component)]]

... but get the following error:

Error: Macro SQL(SELECT * FROM component) failed

This is my config:

[sqlquery]
uri = sqlite:///data/trac/repos/toolkit/db/trac.db


Call stack:

2021-03-05 23:09:48,706 Trac[formatter] DEBUG: Executing Wiki macro SQL
by provider <Component sqlquery.macro.SqlQueryMacro>
2021-03-05 23:09:48,706 Trac[formatter] ERROR: Macro SQL(SELECT * FROM
component) failed for <Resource u'wiki:WikiStart'>:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/trac/wiki/formatter.py",
line 818, in _macro_formatter
return macro.ensure_inline(macro.process(args), in_paragraph)
File "/usr/local/lib/python2.7/dist-packages/trac/wiki/formatter.py",
line 389, in process
text = self.processor(text)
File "/usr/local/lib/python2.7/dist-packages/trac/wiki/formatter.py",
line 361, in _macro_processor
text)
File "/usr/local/lib/python2.7/dist-packages/sqlquery/macro.py", line
53, in expand_macro
db = Connection(self.uri)
File "/usr/local/lib/python2.7/dist-packages/pymills/dbapi.py", line
55, in create_connection
return types[type](*args, **kwargs)
KeyError: u'sqlite:///data/trac/repos/toolkit/db/trac.db'

I double checked the SQLite database path. It is correct.

I have TRAC 1.4.2 on Linux, with SQLite database.

Please help.
Clemens



--
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to trac-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/trac-users/ddc7b518-31ca-3026-f0cb-70171e48fcc8%40osypkamed.com.
Re: SqlQueryMacro failed with SQLite [ In reply to ]
On Friday, March 5, 2021 at 2:25:27 PM UTC-8 Clemens Feige wrote:

> Hello
>
> I struggling with the SqlQueryMacro.
>
> https://trac-hacks.org/wiki/SqlQueryMacro
>
> What I want is to query a SQLite database of another TRAC instance (on
> the same server).
>
> I have this example query in my wiki:
>
> [[SQL(SELECT * FROM component)]]
>
> ... but get the following error:
>
> Error: Macro SQL(SELECT * FROM component) failed
>
> This is my config:
>
> [sqlquery]
> uri = sqlite:///data/trac/repos/toolkit/db/trac.db
>
>
> Call stack:
>
> 2021-03-05 23:09:48,706 Trac[formatter] DEBUG: Executing Wiki macro SQL
> by provider <Component sqlquery.macro.SqlQueryMacro>
> 2021-03-05 23:09:48,706 Trac[formatter] ERROR: Macro SQL(SELECT * FROM
> component) failed for <Resource u'wiki:WikiStart'>:
> Traceback (most recent call last):
> File "/usr/local/lib/python2.7/dist-packages/trac/wiki/formatter.py",
> line 818, in _macro_formatter
> return macro.ensure_inline(macro.process(args), in_paragraph)
> File "/usr/local/lib/python2.7/dist-packages/trac/wiki/formatter.py",
> line 389, in process
> text = self.processor(text)
> File "/usr/local/lib/python2.7/dist-packages/trac/wiki/formatter.py",
> line 361, in _macro_processor
> text)
> File "/usr/local/lib/python2.7/dist-packages/sqlquery/macro.py", line
> 53, in expand_macro
> db = Connection(self.uri)
> File "/usr/local/lib/python2.7/dist-packages/pymills/dbapi.py", line
> 55, in create_connection
> return types[type](*args, **kwargs)
> KeyError: u'sqlite:///data/trac/repos/toolkit/db/trac.db'
>
> I double checked the SQLite database path. It is correct.
>
> I have TRAC 1.4.2 on Linux, with SQLite database.
>
> Please help.
> Clemens
>

The plugin has a dependency on the pymills package and it seems to be a
problem in how the pymills API is used.
The plugin should probably be rewritten to replace the dependency, either
using Trac Environment API or maybe a package like pydal.

Ryan

--
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to trac-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/trac-users/44a441d2-8c16-463e-93fa-a134128c4ac5n%40googlegroups.com.
Re: SqlQueryMacro failed with SQLite [ In reply to ]
On Friday, March 5, 2021 at 8:32:12 PM UTC-8 RjOllos wrote:

> On Friday, March 5, 2021 at 2:25:27 PM UTC-8 Clemens Feige wrote:
>
>> Hello
>>
>> I struggling with the SqlQueryMacro.
>>
>> https://trac-hacks.org/wiki/SqlQueryMacro
>>
>> What I want is to query a SQLite database of another TRAC instance (on
>> the same server).
>>
>> I have this example query in my wiki:
>>
>> [[SQL(SELECT * FROM component)]]
>>
>> ... but get the following error:
>>
>> Error: Macro SQL(SELECT * FROM component) failed
>>
>> This is my config:
>>
>> [sqlquery]
>> uri = sqlite:///data/trac/repos/toolkit/db/trac.db
>>
>>
>> Call stack:
>>
>> 2021-03-05 23:09:48,706 Trac[formatter] DEBUG: Executing Wiki macro SQL
>> by provider <Component sqlquery.macro.SqlQueryMacro>
>> 2021-03-05 23:09:48,706 Trac[formatter] ERROR: Macro SQL(SELECT * FROM
>> component) failed for <Resource u'wiki:WikiStart'>:
>> Traceback (most recent call last):
>> File "/usr/local/lib/python2.7/dist-packages/trac/wiki/formatter.py",
>> line 818, in _macro_formatter
>> return macro.ensure_inline(macro.process(args), in_paragraph)
>> File "/usr/local/lib/python2.7/dist-packages/trac/wiki/formatter.py",
>> line 389, in process
>> text = self.processor(text)
>> File "/usr/local/lib/python2.7/dist-packages/trac/wiki/formatter.py",
>> line 361, in _macro_processor
>> text)
>> File "/usr/local/lib/python2.7/dist-packages/sqlquery/macro.py", line
>> 53, in expand_macro
>> db = Connection(self.uri)
>> File "/usr/local/lib/python2.7/dist-packages/pymills/dbapi.py", line
>> 55, in create_connection
>> return types[type](*args, **kwargs)
>> KeyError: u'sqlite:///data/trac/repos/toolkit/db/trac.db'
>>
>> I double checked the SQLite database path. It is correct.
>>
>> I have TRAC 1.4.2 on Linux, with SQLite database.
>>
>> Please help.
>> Clemens
>>
>
> The plugin has a dependency on the pymills package and it seems to be a
> problem in how the pymills API is used.
> The plugin should probably be rewritten to replace the dependency, either
> using Trac Environment API or maybe a package like pydal.
>
> Ryan
>

See also: https://trac-hacks.org/ticket/12023

--
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to trac-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/trac-users/1e6ab9a3-25ff-4b4d-9665-b0a654aee6f0n%40googlegroups.com.
Re: Re: SqlQueryMacro failed with SQLite [ In reply to ]
RjOllos wrote on 06.03.2021 at 05:33:
> On Friday, March 5, 2021 at 8:32:12 PM UTC-8 RjOllos wrote:
>
> On Friday, March 5, 2021 at 2:25:27 PM UTC-8 Clemens Feige wrote:
>
> Hello
>
> I struggling with the SqlQueryMacro.
>
> https://trac-hacks.org/wiki/SqlQueryMacro
> <https://trac-hacks.org/wiki/SqlQueryMacro>
>
> What I want is to query a SQLite database of another TRAC
> instance (on
> the same server).
>
> I have this example query in my wiki:
>
> [[SQL(SELECT * FROM component)]]
>
> ... but get the following error:
>
> Error: Macro SQL(SELECT * FROM component) failed
>
> This is my config:
>
> [sqlquery]
> uri = sqlite:///data/trac/repos/toolkit/db/trac.db
>
>
> Call stack:
>
> 2021-03-05 23:09:48,706 Trac[formatter] DEBUG: Executing Wiki
> macro SQL
> by provider <Component sqlquery.macro.SqlQueryMacro>
> 2021-03-05 23:09:48,706 Trac[formatter] ERROR: Macro
> SQL(SELECT * FROM
> component) failed for <Resource u'wiki:WikiStart'>:
> Traceback (most recent call last):
> File
> "/usr/local/lib/python2.7/dist-packages/trac/wiki/formatter.py",
> line 818, in _macro_formatter
> return macro.ensure_inline(macro.process(args), in_paragraph)
> File
> "/usr/local/lib/python2.7/dist-packages/trac/wiki/formatter.py",
> line 389, in process
> text = self.processor(text)
> File
> "/usr/local/lib/python2.7/dist-packages/trac/wiki/formatter.py",
> line 361, in _macro_processor
> text)
> File
> "/usr/local/lib/python2.7/dist-packages/sqlquery/macro.py", line
> 53, in expand_macro
> db = Connection(self.uri)
> File
> "/usr/local/lib/python2.7/dist-packages/pymills/dbapi.py", line
> 55, in create_connection
> return types[type](*args, **kwargs)
> KeyError: u'sqlite:///data/trac/repos/toolkit/db/trac.db'
>
> I double checked the SQLite database path. It is correct.
>
> I have TRAC 1.4.2 on Linux, with SQLite database.
>
> Please help.
> Clemens
>
>
> The plugin has a dependency on the pymills package and it seems to
> be a problem in how the pymills API is used.
> The plugin should probably be rewritten to replace the dependency,
> either using Trac Environment APIĀ  or maybe a package like pydal.
>
> Ryan
>
>
> See also: https://trac-hacks.org/ticket/12023
>
I have pymills installed:

$ pip show pymills
Name: pymills
Version: 3.4.2
Summary: Mills Python Library
Home-page: https://bitbucket.org/prologic/pymills
Author: James Mills
Author-email: James Mills, j dot mills at griffith dot edu dot au
License: MIT
Location: /usr/local/lib/python2.7/dist-packages
Requires:
Required-by: TracSqlQueryMacro

But as far as I understand from TrackHacks:#12023 there is an issue with
pymills?

Clemens


--
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to trac-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/trac-users/a6be21d3-e66b-e3ca-aa0d-0d26425c0196%40osypkamed.com.