Just for kicks, I decided to print out the list of connectors right before it
tries to validate what is passed in:
def _get_connector(self): ### FIXME: Make it public?
scheme, args = _parse_db_str(self.connection_uri)
print self.connectors
candidates = [
(priority, connector)
for connector in self.connectors
for scheme_, priority in connector.get_supported_schemes()
if scheme_ == scheme
]
if not candidates:
raise TracError('Unsupported database type "%s"' % scheme)
The root of the problem here is that the list only shows the SQLite connector:
root@host:~# ./sqlite2pg.py --tracenv /path/to/trac -p
'postgres://user:pass@localhost:5432/trac'
[<trac.db.sqlite_backend.SQLiteConnector object at 0x2ee4cd0>]
Why exactly that is, I'm not sure yet, as the connectors (sqlite, mysql,
postgres) are all in the same directory. Gonna keep digging, but open to
suggestions.
Cheers,
Ryan
Ryan Steele wrote:
> I'm working on migrating an installation from SQLite to PostgreSQL,
> but the sqlite2pg script seems to fail, even with all the pre-
> requisite packages installed:
>
> ii python-psycopg2
> 2.0.13-2ubuntu2 Python module for PostgreSQL
> ii python-psycopg2-dbg 2.0.13-2ubuntu2
> Python module for PostgreSQL (debug extension)
> ii python-psycopg2-testsuite 2.0.13-2ubuntu2
> Python module for PostgreSQL
> ii python
> 2.6.5-0ubuntu1 An interactive high-level object-
> oriented language (default version)
> ii postgresql-9.0
> 9.0.4-1~lucid1 object-relational SQL database,
> version 9.0 server
> ii postgresql-client-9.0
> 9.0.4-1~lucid1 front-end programs for PostgreSQL
> 9.0
>
>
>
> root@host:~# ./sqlite2pg.py -e /path/to/trac -p 'postgres://
> user:pass@localhost:5432/trac'
> 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"
>
> I know that the PG backend is supported, because the
> TracEnvironment#DatabaseConnectionStrings wiki page says so (this is
> version 0.11.7), and all of the necessary files exist underneath
> $PYTHONPATH (e.g., postgres_backend.py), so I'm a little confused as
> to what the problem is. If it helps, the relevant part of
> _get_connector is:
>
> def _get_connector(self): ### FIXME: Make it public?
> scheme, args = _parse_db_str(self.connection_uri)
> candidates = [
> (priority, connector)
> for connector in self.connectors
> for scheme_, priority in connector.get_supported_schemes()
> if scheme_ == scheme
> ]
> if not candidates:
> raise TracError('Unsupported database type "%s"' % scheme)
>
> Also, the connectors are defined like so in the DatabaseManager class:
>
> class DatabaseManager(Component):
> connectors = ExtensionPoint(IDatabaseConnector)
>
> The IDatabaseConnector class is what has the get_connection method,
> and in postgres_backend.py, I can see that the PostgreSQLConnector
> class implements IDatabaseConnector:
>
> class PostgreSQLConnector(Component):
> implements(IDatabaseConnector)
>
>
> So, the error provided doesn't make a whole lot of sense to me. I
> would tend to think it's an installation-specific problem (e.g.,
> something nothing being in $PYTHONPATH), but I don't see evidence of
> that here. Any help is most appreciated, and more detail can be
> provided if requested.
>
> Cheers,
> Ryan
--
Ryan Steele
c: (302) 598-1878
e: [email protected]
w: http://www.ryansmind.net/
--
You received this message because you are subscribed to the Google Groups "Trac
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/trac-users?hl=en.