Skip to content
Snippets Groups Projects
Commit ec07ee5c authored by Dennis Ahrens's avatar Dennis Ahrens
Browse files

[FEATURE] #1173 PostgreSQL support added.

parent 4ffb61a8
No related branches found
No related tags found
No related merge requests found
......@@ -9,6 +9,8 @@ Currently supported sources are
- ldap
- oracle
- mysql
- sqlite3
- postgresql
###############################################################################
# Install on Debian
......@@ -24,13 +26,18 @@ You will need to following packages for the building process:
- libldap2-dev
- libsasl2-dev
- libssl-dev
- postgresql-server-dev-9.1
- mercurial
sudo apt-get install python-dev python-setuptools libmysqlclient-dev \
libldap2-dev libsasl2-dev libssl-dev mercurial
You also need to run pip install -U distribute, because we need a higher
version of it.
We need need a higher version of distribute... Execute on Shell:
pip install -U distribute
The environment variable ORACLE_HOME and LD_LIBRARY_PATH must point to your instantclient.
export ORACLE_HOME=/path/to/instant_client_11_2
export LD_LIBRARY_PATH=/path/to/instant_client_11_2
###############################################################################
# Virtualenv
......@@ -43,7 +50,7 @@ in the package:
# create a virtualenv
virtualenv --no-site-packages path/to/your/virtual/env
# activate a virtualenv
. path/to/your/virtual/env/bin/activate
source path/to/your/virtual/env/bin/activate
# deactivate a virtualenv
deactivate
......
......@@ -125,6 +125,8 @@ class Manager(object):
self.add(storage_interface_name, OracleStorageInterface(uri, config))
elif storage_interface_type == "sqlite":
self.add(storage_interface_name, SQLiteStorageInterface(uri, config))
elif storage_interface_type == "postgresql":
self.add(storage_interface_name, PostgreSQLStorageInterface(uri, config))
elif storage_interface_type == "ldap":
self.add(storage_interface_name, LdapStorageInterface(uri, config))
elif storage_interface_type == "file":
......@@ -426,6 +428,12 @@ class MySQLStorageInterface(SqlAlchemyStorageInterface):
'''A storage_interface to a mysql database using sqlalchemy.'''
pass
class SQLiteStorageInterface(SqlAlchemyStorageInterface):
'''A storage_interface to a sqlite database using sqlalchemy.'''
pass
class PostgreSQLStorageInterface(SqlAlchemyStorageInterface):
'''A storage interface to a postgresql database using sqlalchemy.'''
pass
......@@ -101,6 +101,9 @@ class TestManager(unittest.TestCase):
self.manager.create('sqlite', 'sqlite:///:memory:', {'encoding': 'utf-8'})
self.assertEqual(self.manager.add.call_args[0][0], 'sqlite', 'Create hands over the storage_interfaceName manipulated.')
self.assertIsInstance(self.manager.add.call_args[0][1], connections.SQLiteStorageInterface, 'Wrong storage_interface created.')
self.manager.create('postgresql', 'postgresql://scott:tiger@localhost:5432/mydatabase', {'encoding': 'utf-8'})
self.assertEqual(self.manager.add.call_args[0][0], 'postgresql', 'Create hands over the storage_interfaceName manipulated.')
self.assertIsInstance(self.manager.add.call_args[0][1], connections.PostgreSQLStorageInterface, 'Wrong storage_interface created.')
def test_create_raises_on_unknown_types(self):
unsupport_types = ['sdadas', 'dsad', 'mysqli', 'oarcle']
......
......@@ -38,6 +38,7 @@ setup(
'cx_Oracle >= 5.1.2',
'python-ldap >= 2.3.13',
'mysql-python >= 1.2.3',
'psycopg2 >= 2.4.5',
'mock'
],
dependency_links=[
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment