Modify

Opened 13 years ago

Closed 12 years ago

#9098 closed defect (wontfix)

No connector loaded for postgres schema

Reported by: ryan.g.steele@… Owned by: John Hampton
Priority: normal Component: SqliteToPgScript
Severity: blocker Keywords: postgres connector unsupported
Cc: Trac Release: 0.11

Description (last modified by Ryan J Ollos)

First, some pre-requisite information:

The command I'm using is:

./sqlite2pg.py -e /path/to/trac -p 'postgres://user:pass@localhost:5432/trac'

The stack trace I'm getting is:

Traceback (most recent call last):
  File "./sqlite2pg.py", line 335, in <module>
    sys.exit(main(sys.argv[1:]))
  File "./sqlite2pg.py", line 331, in main
    Main(opts)
  File "./sqlite2pg.py", line 244, in Main
    pgenv = getPostgreSQLEnvironment(opts)
  File "./sqlite2pg.py", line 209, in getPostgreSQLEnvironment
    cnx = env.get_db_cnx()
  File "/usr/lib/python2.6/dist-packages/trac/env.py", line 285, in
get_db_cnx
    return DatabaseManager(self).get_connection()
  File "/usr/lib/python2.6/dist-packages/trac/db/api.py", line 90, in
get_connection
    connector, args = self._get_connector()
  File "/usr/lib/python2.6/dist-packages/trac/db/api.py", line 131, in
_get_connector
    raise TracError('Unsupported database type "%s"' % scheme)
trac.core.TracError: Unsupported database type "postgres"

The sys.path is:

['/root', '/usr/lib/python2.6', '/usr/lib/python2.6/plat-linux2',
'/usr/lib/python2.6/lib-tk', '/usr/lib/python2.6/lib-old',
'/usr/lib/python2.6/lib-dynload', '/usr/lib/python2.6/dist-packages',
'/usr/lib/python2.6/dist-packages/PIL', '/usr/lib/pymodules/python2.6',
'/usr/lib/pymodules/python2.6/gtk-2.0', '/usr/local/lib/python2.6/dist-packages']

The relevant modules are located in the sys.path path:

/usr/lib/python2.6/dist-packages/psycopg2
/usr/lib/python2.6/dist-packages/trac
/usr/lib/python2.6/dist-packages/trac/db/postgres_backend.py
/usr/lib/python2.6/dist-packages/trac/db/sqlite_backend.py

Debugging output shows that the script finds psycopg2, but doesn't load the PG connector:

has_psycopg: True
scheme: postgres
connectors: [<trac.db.sqlite_backend.SQLiteConnector object at 0x1c12b10>]
candidates: []

And, that's the reason the script fails, and the reason I've filed this ticket. The 'postgres' schema doesn't match any in the candidates list. I truly don't believe this is a path issue, given the information above. A thread I started on the trac-users mailing list can be found archived here, in case it helps to fill in any gaps: http://www.gossamer-threads.com/lists/trac/users/48799

Cheers, Ryan

Attachments (0)

Change History (4)

comment:1 Changed 13 years ago by ryan.g.steele@…

FYI, this is with Trac 0.11.7, and the latest version of sqlite2pg (0.10)

comment:2 Changed 13 years ago by anonymous

I discovered the problem today, and hopefully this can benefit others having similar problems. In my trac.ini, the following parameter was set:

trac.db.postgres_backend.postgresqlconnector = disabled

I'm not sure that's even required when using non-Postgres backend (the MySQL connector was disabled as well), but for some reason it was in there. I hadn't thought to look in trac.ini for this particular issue for two reasons: first, the existing installation only needed the SQLite connector, so it didn't seem intuitive to assume that sqlite2pg would use trac.ini to determine the validity of other connectors (that's what sqlite2pg's connection string argument is for); additionally, I could find no documentation that indicated modifications to trac.ini were relevant, let alone necessary, until after the backend conversion had completed (i.e., changing the database connection string from sqlite to postgres to begin using the PG backend).

Given this turn of events, I believe the ticket can be closed. However, I think it underscores the benefits of documenting these types of blocking dependencies on trac.ini in the sqlite2pg documentation/help option, which is something I'd be happy to do if patches to the script and/or documentation will be accepted.

comment:3 Changed 12 years ago by Ryan J Ollos

Description: modified (diff)

comment:4 Changed 12 years ago by Ryan J Ollos

Resolution: wontfix
Status: newclosed

This plugin is deprecated. See the TracMigratePlugin.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain John Hampton.
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.