Hi Galaxy Developers

 

I aim to write a tool that will interact with Postgres database; here is what I wrote to test database connectivity. This script resides in /galaxy-dist/tools/test_tool/ and gets invoked from the front end. However script generate following error: No module named psycopg2.

 

Here is my code:

#!/usr/bin/env python

 

import os.path

import os

from galaxy import eggs

from galaxy.model import *

from sqlalchemy import *

 

engine = create_engine('postgresql://postgres:@192.168.0.6:5432/galaxy')

connection = engine.connect()

result_set = connection.execute( "select id from galaxy_user" )

for row in result_set:

                print row[ 'id' ]

                connection.close()

 

 

Traceback (most recent call last):

  File "/galaxy-dist/tools/overlapanalysis/db_test.py", line 10, in ?

    engine = create_engine('postgresql://postgres:@192.168.0.6:5432/galaxy')

  File "/galaxy-dist/eggs/SQLAlchemy-0.5.6_dev_r6498-py2.4.egg/sqlalchemy/engine/__init__.py", line 223, in create_engine

    return strategy.create(*args, **kwargs)

  File "/galaxy-dist/eggs/SQLAlchemy-0.5.6_dev_r6498-py2.4.egg/sqlalchemy/engine/strategies.py", line 62, in create

    dbapi = dialect_cls.dbapi(**dbapi_args)

  File "/galaxy-dist/eggs/SQLAlchemy-0.5.6_dev_r6498-py2.4.egg/sqlalchemy/databases/postgres.py", line 368, in dbapi

    import psycopg2 as psycopg

ImportError: No module named psycopg2

 

Thanks for any help.

Regards

MK