Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Trac: Users

Re: Migrating from SQLite to PostgreSQL

 

 

Trac users RSS feed   Index | Next | Previous | View Threaded


ryan.g.steele at gmail

Aug 12, 2011, 11:43 AM

Post #1 of 10 (1270 views)
Permalink
Re: Migrating from SQLite to PostgreSQL

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 [at] hos:~# ./sqlite2pg.py --tracenv /path/to/trac -p
'postgres://user:pass [at] localhos: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 [at] hos:~# ./sqlite2pg.py -e /path/to/trac -p 'postgres://
> user:pass [at] localhos: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: ryan.g.steele [at] gmail
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 trac-users [at] googlegroups
To unsubscribe from this group, send email to trac-users+unsubscribe [at] googlegroups
For more options, visit this group at http://groups.google.com/group/trac-users?hl=en.


mark.cooke at siemens

Aug 15, 2011, 1:08 AM

Post #2 of 10 (1224 views)
Permalink
RE: Re: Migrating from SQLite to PostgreSQL [In reply to]

> 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 [at] hos:~# ./sqlite2pg.py -e /path/to/trac -p 'postgres://
> > user:pass [at] localhos: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
>
> -----Original Message-----
> From: trac-users [at] googlegroups
> [mailto:trac-users [at] googlegroups] On Behalf Of Ryan Steele
> Sent: 12 August 2011 19:43
> To: Trac Users
> Subject: [Trac] Re: Migrating from SQLite to PostgreSQL
>
> 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 [at] hos:~# ./sqlite2pg.py --tracenv /path/to/trac -p
> 'postgres://user:pass [at] localhos: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
>
I am guessing but... if that error is coming from the script and your trac works OK (have you tried just creating a new, empty trac using PostgreSQL as the backend to make sure?) then perhaps it is to do with the way trac is configured... Is it in some sort of python virtualenv which would mean when you _run_ the script (instead of www-user etc) does not see the postgresql code?

~ mark c

--
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To post to this group, send email to trac-users [at] googlegroups
To unsubscribe from this group, send email to trac-users+unsubscribe [at] googlegroups
For more options, visit this group at http://groups.google.com/group/trac-users?hl=en.


ryan.g.steele at gmail

Aug 15, 2011, 4:57 AM

Post #3 of 10 (1233 views)
Permalink
Re: Re: Migrating from SQLite to PostgreSQL [In reply to]

Thanks for the reply - responses inline below:

Cooke, Mark wrote:
>> 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 [at] hos:~# ./sqlite2pg.py -e /path/to/trac -p 'postgres://
>>> user:pass [at] localhos: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
>> -----Original Message----- From: trac-users [at] googlegroups
>> [mailto:trac-users [at] googlegroups] On Behalf Of Ryan Steele Sent: 12
>> August 2011 19:43 To: Trac Users Subject: [Trac] Re: Migrating from SQLite
>> to PostgreSQL
>>
>> 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 [at] hos:~# ./sqlite2pg.py --tracenv /path/to/trac -p
>> 'postgres://user:pass [at] localhos: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
>>
> I am guessing but... if that error is coming from the script and your trac
> works OK (have you tried just creating a new, empty trac using PostgreSQL as
> the backend to make sure?)


I was able to create a brand new Trac environment with initenv when testing
using PG as the backend, so functionally that works. The only problem is with
the migration script not finding anything but the default SQLite connector, even
though the paths and such appear to be correct.


> then perhaps it is to do with the way trac is configured...


But it's not even getting to that point - it's literally failing because the
database type "postgres" isn't recognized, due to the fact that the PostgreSQL
connector isn't being found and thus isn't in the list of valid candidates.


> Is it in some sort of python virtualenv which would mean when you _run_ the
> script (instead of www-user etc) does not see the postgresql code?


I tried running it as the webserver just for kicks, even though I was pretty
sure that wasn't the problem, and I still see the same issue - the only
connector candidate found is the default SQLite connector:

>> def _get_connector(self): ### FIXME: Make it public?
>> scheme, args = _parse_db_str(self.connection_uri)
>> print self.connectors ### ADDED BY ME TO PRINT LIST OF 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)

>> root [at] hos:~# ./sqlite2pg.py --tracenv /path/to/trac -p
>> 'postgres://user:pass [at] localhos:5432/trac'
>>
>> [<trac.db.sqlite_backend.SQLiteConnector object at 0x2ee4cd0>]

I also added some debugging to determine whether or not the psycopg2 libs were
properly detected, and they are. This is from the top of postgres_backend.py:


has_psycopg = False
has_pgsql = False
PGSchemaError = None
try:
import psycopg2 as psycopg
import psycopg2.extensions
from psycopg2 import ProgrammingError as PGSchemaError
psycopg2.extensions.register_type(psycopg2.extensions.UNICODE)
has_psycopg = True
except ImportError:
try:
from pyPgSQL import PgSQL
from pyPgSQL.libpq import OperationalError as PGSchemaError
has_pgsql = True
except ImportError:
pass

print "HAS PSYCOPG:"
print has_psycopg

...and, the output I get is:

HAS PSYCOPG:
True

But alas, I still get:

Traceback (most recent call last):
File "./sqlite2pg.py", line 337, in <module>
sys.exit(main(sys.argv[1:]))
File "./sqlite2pg.py", line 333, in main
Main(opts)
File "./sqlite2pg.py", line 246, in Main
pgenv = getPostgreSQLEnvironment(opts)
File "./sqlite2pg.py", line 210, 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 138, in
_get_connector
raise TracError('Unsupported database type "%s"' % scheme)
trac.core.TracError: Unsupported database type "postgres"


Maybe wiser minds have a better perspective on the situation, but it still looks
to me like the problem is the PostgreSQL connector not being loaded. As to why
that is... not sure yet. Open to opinions, though :)

Cheers,
Ryan

--
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To post to this group, send email to trac-users [at] googlegroups
To unsubscribe from this group, send email to trac-users+unsubscribe [at] googlegroups
For more options, visit this group at http://groups.google.com/group/trac-users?hl=en.


mark.cooke at siemens

Aug 15, 2011, 6:46 AM

Post #4 of 10 (1225 views)
Permalink
RE: Re: Migrating from SQLite to PostgreSQL [In reply to]

> -----Original Message-----
> From: trac-users [at] googlegroups
> [mailto:trac-users [at] googlegroups] On Behalf Of Ryan Steele
> Sent: 15 August 2011 12:58
> To: trac-users [at] googlegroups
> Subject: Re: [Trac] Re: Migrating from SQLite to PostgreSQL
>
> Thanks for the reply - responses inline below:
>
> Cooke, Mark wrote:
> >> 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 [at] hos:~# ./sqlite2pg.py -e /path/to/trac -p 'postgres://
> >>> user:pass [at] localhos: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
> >> -----Original Message----- From: trac-users [at] googlegroups
> >> [mailto:trac-users [at] googlegroups] On Behalf Of Ryan
> Steele Sent: 12
> >> August 2011 19:43 To: Trac Users Subject: [Trac] Re:
> Migrating from SQLite
> >> to PostgreSQL
> >>
> >> 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 [at] hos:~# ./sqlite2pg.py --tracenv /path/to/trac -p
> >> 'postgres://user:pass [at] localhos: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
> >>
> > I am guessing but... if that error is coming from the
> script and your trac
> > works OK (have you tried just creating a new, empty trac
> using PostgreSQL as
> > the backend to make sure?)
>
>
> I was able to create a brand new Trac environment with
> initenv when testing
> using PG as the backend, so functionally that works. The
> only problem is with
> the migration script not finding anything but the default
> SQLite connector, even
> though the paths and such appear to be correct.
>
>
> > then perhaps it is to do with the way trac is configured...
>
>
> But it's not even getting to that point - it's literally
> failing because the
> database type "postgres" isn't recognized, due to the fact
> that the PostgreSQL
> connector isn't being found and thus isn't in the list of
> valid candidates.
>
>
> > Is it in some sort of python virtualenv which would mean
> when you _run_ the
> > script (instead of www-user etc) does not see the postgresql code?
>
>
> I tried running it as the webserver just for kicks, even
> though I was pretty
> sure that wasn't the problem, and I still see the same issue
> - the only
> connector candidate found is the default SQLite connector:
>
> >> def _get_connector(self): ### FIXME: Make it public?
> >> scheme, args = _parse_db_str(self.connection_uri)
> >> print self.connectors ### ADDED BY ME TO PRINT LIST OF
> 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)
>
> >> root [at] hos:~# ./sqlite2pg.py --tracenv /path/to/trac -p
> >> 'postgres://user:pass [at] localhos:5432/trac'
> >>
> >> [<trac.db.sqlite_backend.SQLiteConnector object at 0x2ee4cd0>]
>
> I also added some debugging to determine whether or not the
> psycopg2 libs were
> properly detected, and they are. This is from the top of
> postgres_backend.py:
>
>
> has_psycopg = False
> has_pgsql = False
> PGSchemaError = None
> try:
> import psycopg2 as psycopg
> import psycopg2.extensions
> from psycopg2 import ProgrammingError as PGSchemaError
> psycopg2.extensions.register_type(psycopg2.extensions.UNICODE)
> has_psycopg = True
> except ImportError:
> try:
> from pyPgSQL import PgSQL
> from pyPgSQL.libpq import OperationalError as PGSchemaError
> has_pgsql = True
> except ImportError:
> pass
>
> print "HAS PSYCOPG:"
> print has_psycopg
>
> ...and, the output I get is:
>
> HAS PSYCOPG:
> True
>
> But alas, I still get:
>
> Traceback (most recent call last):
> File "./sqlite2pg.py", line 337, in <module>
> sys.exit(main(sys.argv[1:]))
> File "./sqlite2pg.py", line 333, in main
> Main(opts)
> File "./sqlite2pg.py", line 246, in Main
> pgenv = getPostgreSQLEnvironment(opts)
> File "./sqlite2pg.py", line 210, 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 138, in
> _get_connector
> raise TracError('Unsupported database type "%s"' % scheme)
> trac.core.TracError: Unsupported database type "postgres"
>
>
> Maybe wiser minds have a better perspective on the situation,
> but it still looks
> to me like the problem is the PostgreSQL connector not being
> loaded. As to why
> that is... not sure yet. Open to opinions, though :)
>
> Cheers,
> Ryan
>
Seeing as you sound like someone capable of tinkering with code, what happens if you try to use pyscopg2 directly from a python prompt to access the backend dB you setup with that new project earlier? Lets take Trac and the script out of this until we know that pyscopg2 works for your user OK...

~ mark c

--
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To post to this group, send email to trac-users [at] googlegroups
To unsubscribe from this group, send email to trac-users+unsubscribe [at] googlegroups
For more options, visit this group at http://groups.google.com/group/trac-users?hl=en.


ryan.g.steele at gmail

Aug 15, 2011, 12:12 PM

Post #5 of 10 (1224 views)
Permalink
Re: Re: Migrating from SQLite to PostgreSQL [In reply to]

Cooke, Mark wrote:
> Seeing as you sound like someone capable of tinkering with code, what happens
> if you try to use pyscopg2 directly from a python prompt to access the
> backend dB you setup with that new project earlier? Lets take Trac and the
> script out of this until we know that pyscopg2 works for your user OK...
>
> ~ mark c
>

Well, isn't psycopg2 required to perform 'trac-admin /path/to/trac initenv ...'
for a PG backend? Since that worked, I would think that's a valid test, unless
you feel differently?

Cheers,
Ryan

--
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To post to this group, send email to trac-users [at] googlegroups
To unsubscribe from this group, send email to trac-users+unsubscribe [at] googlegroups
For more options, visit this group at http://groups.google.com/group/trac-users?hl=en.


mark.cooke at siemens

Aug 16, 2011, 12:19 AM

Post #6 of 10 (1220 views)
Permalink
RE: Re: Migrating from SQLite to PostgreSQL [In reply to]

> -----Original Message-----
> From: trac-users [at] googlegroups
> [mailto:trac-users [at] googlegroups] On Behalf Of Ryan Steele
> Sent: 15 August 2011 20:13
> To: trac-users [at] googlegroups
> Subject: Re: [Trac] Re: Migrating from SQLite to PostgreSQL
>
> Cooke, Mark wrote:
> > Seeing as you sound like someone capable of tinkering with
> > code, what happens if you try to use pyscopg2 directly from
> > a python prompt to access the backend dB you setup with that
> > new project earlier? Lets take Trac and the script out of
> > this until we know that pyscopg2 works for your user OK...
> >
> > ~ mark c
> >
>
> Well, isn't psycopg2 required to perform 'trac-admin
> /path/to/trac initenv ...'
> for a PG backend? Since that worked, I would think that's a
> valid test, unless you feel differently?
>
> Cheers,
> Ryan
>
Hmm, yes, I suppose so! I know nothing about the script you mentioned and at the moment I am running out of ideas. I just checked and someone claims that the script worked fine with 0.11 but that the last update was in 2008.

What is the command line you are using?

Perhaps someone else can suggest something?

~ mark c

--
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To post to this group, send email to trac-users [at] googlegroups
To unsubscribe from this group, send email to trac-users+unsubscribe [at] googlegroups
For more options, visit this group at http://groups.google.com/group/trac-users?hl=en.


ryan.g.steele at gmail

Aug 16, 2011, 5:26 AM

Post #7 of 10 (1222 views)
Permalink
Re: Re: Migrating from SQLite to PostgreSQL [In reply to]

Cooke, Mark wrote:
>> -----Original Message----- From: trac-users [at] googlegroups
>> [mailto:trac-users [at] googlegroups] On Behalf Of Ryan Steele Sent: 15
>> August 2011 20:13 To: trac-users [at] googlegroups Subject: Re: [Trac] Re:
>> Migrating from SQLite to PostgreSQL
>>
>> Cooke, Mark wrote:
>>> Seeing as you sound like someone capable of tinkering with code, what
>>> happens if you try to use pyscopg2 directly from a python prompt to
>>> access the backend dB you setup with that new project earlier? Lets take
>>> Trac and the script out of this until we know that pyscopg2 works for
>>> your user OK...
>>>
>>> ~ mark c
>>>
>> Well, isn't psycopg2 required to perform 'trac-admin /path/to/trac initenv
>> ...' for a PG backend? Since that worked, I would think that's a valid
>> test, unless you feel differently?
>>
>> Cheers, Ryan
>>
> Hmm, yes, I suppose so! I know nothing about the script you mentioned and at
> the moment I am running out of ideas. I just checked and someone claims that
> the script worked fine with 0.11 but that the last update was in 2008.
>
> What is the command line you are using?
>
> Perhaps someone else can suggest something?
>
> ~ mark c
>


I appreciate the help, anyways. Maybe John Hampton will get a chance to hop in,
since he authored the script.

The command is:
./sqlite2pg.py -e /path/to/trac -p 'postgres://user:pass [at] localhos:5432/trac'


The stack trace 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 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 it 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 it fails - the 'postgres' schema doesn't match any in the
candidates list. If it's not a path issue, which it appears not to be, I'd
almost say it kinda feels like a namespace issue. Others have reported this
problem (when the paths are correct), but unfortunately there are no resolutions
out there.


Cheers,
Ryan

--
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To post to this group, send email to trac-users [at] googlegroups
To unsubscribe from this group, send email to trac-users+unsubscribe [at] googlegroups
For more options, visit this group at http://groups.google.com/group/trac-users?hl=en.


thomas.tressieres at ca-cib

Aug 31, 2011, 12:37 AM

Post #8 of 10 (1105 views)
Permalink
RE: Re: Migrating from SQLite to PostgreSQL [In reply to]

Hi,

I'm currently trying to convert a sqlite to postgres database and i found your problem. I use Trac 0.12.2

The solution is to add in trac.ini file the following line in [components] section

trac.db.postgres_backend.postgresqlconnector = enabled

Hope that helps....

Regards


-----Original Message-----
From: trac-users [at] googlegroups [mailto:trac-users [at] googlegroups] On Behalf Of Ryan Steele
Sent: mardi 16 août 2011 14:26
To: trac-users [at] googlegroups
Subject: Re: [Trac] Re: Migrating from SQLite to PostgreSQL

Cooke, Mark wrote:
>> -----Original Message----- From: trac-users [at] googlegroups
>> [mailto:trac-users [at] googlegroups] On Behalf Of Ryan Steele Sent: 15
>> August 2011 20:13 To: trac-users [at] googlegroups Subject: Re: [Trac] Re:
>> Migrating from SQLite to PostgreSQL
>>
>> Cooke, Mark wrote:
>>> Seeing as you sound like someone capable of tinkering with code, what
>>> happens if you try to use pyscopg2 directly from a python prompt to
>>> access the backend dB you setup with that new project earlier? Lets take
>>> Trac and the script out of this until we know that pyscopg2 works for
>>> your user OK...
>>>
>>> ~ mark c
>>>
>> Well, isn't psycopg2 required to perform 'trac-admin /path/to/trac initenv
>> ...' for a PG backend? Since that worked, I would think that's a valid
>> test, unless you feel differently?
>>
>> Cheers, Ryan
>>
> Hmm, yes, I suppose so! I know nothing about the script you mentioned and at
> the moment I am running out of ideas. I just checked and someone claims that
> the script worked fine with 0.11 but that the last update was in 2008.
>
> What is the command line you are using?
>
> Perhaps someone else can suggest something?
>
> ~ mark c
>


I appreciate the help, anyways. Maybe John Hampton will get a chance to hop in,
since he authored the script.

The command is:
./sqlite2pg.py -e /path/to/trac -p 'postgres://user:pass [at] localhos:5432/trac'


The stack trace 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 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 it 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 it fails - the 'postgres' schema doesn't match any in the
candidates list. If it's not a path issue, which it appears not to be, I'd
almost say it kinda feels like a namespace issue. Others have reported this
problem (when the paths are correct), but unfortunately there are no resolutions
out there.


Cheers,
Ryan

--
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To post to this group, send email to trac-users [at] googlegroups
To unsubscribe from this group, send email to trac-users+unsubscribe [at] googlegroups
For more options, visit this group at http://groups.google.com/group/trac-users?hl=en.

This message and any attachments are intended for the sole use of its addressee.
If you are not the addressee, please immediately notify the sender and then destroy the message.
As this message and/or any attachments may have been altered without our knowledge, its content is not legally binding on Crédit Agricole Corporate and Investment Bank.
All rights reserved.


Ce message et ses pièces jointes sont destinés à l'usage exclusif de leur destinataire.
Si vous recevez ce message par erreur, merci d'en aviser immédiatement l'expéditeur et de le détruire ensuite.
Le présent message pouvant être altéré à notre insu, Crédit Agricole Corporate and Investment Bank ne peut pas être engagé par son contenu.
Tous droits réservés.

--
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To post to this group, send email to trac-users [at] googlegroups
To unsubscribe from this group, send email to trac-users+unsubscribe [at] googlegroups
For more options, visit this group at http://groups.google.com/group/trac-users?hl=en.


mark.cooke at siemens

Aug 31, 2011, 12:49 AM

Post #9 of 10 (1103 views)
Permalink
RE: Re: Migrating from SQLite to PostgreSQL [In reply to]

> -----Original Message-----
> From: trac-users [at] googlegroups On Behalf Of Tressières,
> Thomas (CA-CIB)
> Sent: 31 August 2011 08:37
> To: trac-users [at] googlegroups
> Subject: RE: [Trac] Re: Migrating from SQLite to PostgreSQL
>
> Hi,
>
> I'm currently trying to convert a sqlite to postgres database
> and i found your problem. I use Trac 0.12.2
>
> The solution is to add in trac.ini file the following line in
> [components] section
>
> trac.db.postgres_backend.postgresqlconnector = enabled
>
> Hope that helps....
>

I can only say "D'oh!" (why didn't I think of that) ~ and "Thanks!"

~ mark c

> -----Original Message-----
> From: trac-users [at] googlegroups
> [mailto:trac-users [at] googlegroups] On Behalf Of Ryan Steele
> Sent: mardi 16 août 2011 14:26
> To: trac-users [at] googlegroups
> Subject: Re: [Trac] Re: Migrating from SQLite to PostgreSQL
>
> Cooke, Mark wrote:
> >> -----Original Message----- From: trac-users [at] googlegroups
> >> [mailto:trac-users [at] googlegroups] On Behalf Of Ryan
> Steele Sent: 15
> >> August 2011 20:13 To: trac-users [at] googlegroups Subject:
> Re: [Trac] Re:
> >> Migrating from SQLite to PostgreSQL
> >>
> >> Cooke, Mark wrote:
> >>> Seeing as you sound like someone capable of tinkering
> with code, what
> >>> happens if you try to use pyscopg2 directly from a python
> prompt to
> >>> access the backend dB you setup with that new project
> earlier? Lets take
> >>> Trac and the script out of this until we know that
> pyscopg2 works for
> >>> your user OK...
> >>>
> >>> ~ mark c
> >>>
> >> Well, isn't psycopg2 required to perform 'trac-admin
> /path/to/trac initenv
> >> ...' for a PG backend? Since that worked, I would think
> that's a valid
> >> test, unless you feel differently?
> >>
> >> Cheers, Ryan
> >>
> > Hmm, yes, I suppose so! I know nothing about the script
> you mentioned and at
> > the moment I am running out of ideas. I just checked and
> someone claims that
> > the script worked fine with 0.11 but that the last update
> was in 2008.
> >
> > What is the command line you are using?
> >
> > Perhaps someone else can suggest something?
> >
> > ~ mark c
> >
>
>
> I appreciate the help, anyways. Maybe John Hampton will get
> a chance to hop in,
> since he authored the script.
>
> The command is:
> ./sqlite2pg.py -e /path/to/trac -p
> 'postgres://user:pass [at] localhos:5432/trac'
>
>
> The stack trace 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 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 it 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 it fails - the 'postgres' schema
> doesn't match any in the
> candidates list. If it's not a path issue, which it appears
> not to be, I'd
> almost say it kinda feels like a namespace issue. Others
> have reported this
> problem (when the paths are correct), but unfortunately there
> are no resolutions
> out there.
>
>
> Cheers,
> Ryan
>
> --
> You received this message because you are subscribed to the
> Google Groups "Trac Users" group.
> To post to this group, send email to trac-users [at] googlegroups
> To unsubscribe from this group, send email to
> trac-users+unsubscribe [at] googlegroups
> For more options, visit this group at
> http://groups.google.com/group/trac-users?hl=en.
>
> This message and any attachments are intended for the sole
> use of its addressee.
> If you are not the addressee, please immediately notify the
> sender and then destroy the message.
> As this message and/or any attachments may have been altered
> without our knowledge, its content is not legally binding on
> Crédit Agricole Corporate and Investment Bank.
> All rights reserved.
>
>
> Ce message et ses pièces jointes sont destinés à l'usage
> exclusif de leur destinataire.
> Si vous recevez ce message par erreur, merci d'en aviser
> immédiatement l'expéditeur et de le détruire ensuite.
> Le présent message pouvant être altéré à notre insu, Crédit
> Agricole Corporate and Investment Bank ne peut pas être
> engagé par son contenu.
> Tous droits réservés.
>
> --
> You received this message because you are subscribed to the
> Google Groups "Trac Users" group.
> To post to this group, send email to trac-users [at] googlegroups
> To unsubscribe from this group, send email to
> trac-users+unsubscribe [at] googlegroups
> For more options, visit this group at
> http://groups.google.com/group/trac-users?hl=en.
>
>

--
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To post to this group, send email to trac-users [at] googlegroups
To unsubscribe from this group, send email to trac-users+unsubscribe [at] googlegroups
For more options, visit this group at http://groups.google.com/group/trac-users?hl=en.


ryan.g.steele at gmail

Aug 31, 2011, 4:19 AM

Post #10 of 10 (1100 views)
Permalink
Re: Re: Migrating from SQLite to PostgreSQL [In reply to]

Hi,

I had actually found that resolution, and commented here:
http://trac-hacks.org/ticket/9098. Guess I forgot to reply to the list as well.
Oops. :)

Thanks for the reply though!

Cheers,
Ryan

Cooke, Mark wrote:
>> -----Original Message-----
>> From: trac-users [at] googlegroups On Behalf Of Tressières,
>> Thomas (CA-CIB)
>> Sent: 31 August 2011 08:37
>> To: trac-users [at] googlegroups
>> Subject: RE: [Trac] Re: Migrating from SQLite to PostgreSQL
>>
>> Hi,
>>
>> I'm currently trying to convert a sqlite to postgres database
>> and i found your problem. I use Trac 0.12.2
>>
>> The solution is to add in trac.ini file the following line in
>> [components] section
>>
>> trac.db.postgres_backend.postgresqlconnector = enabled
>>
>> Hope that helps....
>>
>
> I can only say "D'oh!" (why didn't I think of that) ~ and "Thanks!"
>
> ~ mark c
>
>> -----Original Message-----
>> From: trac-users [at] googlegroups
>> [mailto:trac-users [at] googlegroups] On Behalf Of Ryan Steele
>> Sent: mardi 16 août 2011 14:26
>> To: trac-users [at] googlegroups
>> Subject: Re: [Trac] Re: Migrating from SQLite to PostgreSQL
>>
>> Cooke, Mark wrote:
>>>> -----Original Message----- From: trac-users [at] googlegroups
>>>> [mailto:trac-users [at] googlegroups] On Behalf Of Ryan
>> Steele Sent: 15
>>>> August 2011 20:13 To: trac-users [at] googlegroups Subject:
>> Re: [Trac] Re:
>>>> Migrating from SQLite to PostgreSQL
>>>>
>>>> Cooke, Mark wrote:
>>>>> Seeing as you sound like someone capable of tinkering
>> with code, what
>>>>> happens if you try to use pyscopg2 directly from a python
>> prompt to
>>>>> access the backend dB you setup with that new project
>> earlier? Lets take
>>>>> Trac and the script out of this until we know that
>> pyscopg2 works for
>>>>> your user OK...
>>>>>
>>>>> ~ mark c
>>>>>
>>>> Well, isn't psycopg2 required to perform 'trac-admin
>> /path/to/trac initenv
>>>> ...' for a PG backend? Since that worked, I would think
>> that's a valid
>>>> test, unless you feel differently?
>>>>
>>>> Cheers, Ryan
>>>>
>>> Hmm, yes, I suppose so! I know nothing about the script
>> you mentioned and at
>>> the moment I am running out of ideas. I just checked and
>> someone claims that
>>> the script worked fine with 0.11 but that the last update
>> was in 2008.
>>> What is the command line you are using?
>>>
>>> Perhaps someone else can suggest something?
>>>
>>> ~ mark c
>>>
>>
>> I appreciate the help, anyways. Maybe John Hampton will get
>> a chance to hop in,
>> since he authored the script.
>>
>> The command is:
>> ./sqlite2pg.py -e /path/to/trac -p
>> 'postgres://user:pass [at] localhos:5432/trac'
>>
>>
>> The stack trace 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 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 it 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 it fails - the 'postgres' schema
>> doesn't match any in the
>> candidates list. If it's not a path issue, which it appears
>> not to be, I'd
>> almost say it kinda feels like a namespace issue. Others
>> have reported this
>> problem (when the paths are correct), but unfortunately there
>> are no resolutions
>> out there.
>>
>>
>> Cheers,
>> Ryan
>>
>> --
>> You received this message because you are subscribed to the
>> Google Groups "Trac Users" group.
>> To post to this group, send email to trac-users [at] googlegroups
>> To unsubscribe from this group, send email to
>> trac-users+unsubscribe [at] googlegroups
>> For more options, visit this group at
>> http://groups.google.com/group/trac-users?hl=en.
>>
>> This message and any attachments are intended for the sole
>> use of its addressee.
>> If you are not the addressee, please immediately notify the
>> sender and then destroy the message.
>> As this message and/or any attachments may have been altered
>> without our knowledge, its content is not legally binding on
>> Crédit Agricole Corporate and Investment Bank.
>> All rights reserved.
>>
>>
>> Ce message et ses pièces jointes sont destinés à l'usage
>> exclusif de leur destinataire.
>> Si vous recevez ce message par erreur, merci d'en aviser
>> immédiatement l'expéditeur et de le détruire ensuite.
>> Le présent message pouvant être altéré à notre insu, Crédit
>> Agricole Corporate and Investment Bank ne peut pas être
>> engagé par son contenu.
>> Tous droits réservés.
>>
>> --
>> You received this message because you are subscribed to the
>> Google Groups "Trac Users" group.
>> To post to this group, send email to trac-users [at] googlegroups
>> To unsubscribe from this group, send email to
>> trac-users+unsubscribe [at] googlegroups
>> For more options, visit this group at
>> http://groups.google.com/group/trac-users?hl=en.
>>
>>
>


--
Ryan Steele

c: (302) 598-1878
e: ryan.g.steele [at] gmail
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 trac-users [at] googlegroups
To unsubscribe from this group, send email to trac-users+unsubscribe [at] googlegroups
For more options, visit this group at http://groups.google.com/group/trac-users?hl=en.

Trac users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.