Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hshetl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tools
hshetl
Commits
ec07ee5c
Commit
ec07ee5c
authored
12 years ago
by
Dennis Ahrens
Browse files
Options
Downloads
Patches
Plain Diff
[FEATURE] #1173 PostgreSQL support added.
parent
4ffb61a8
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
README
+10
-3
10 additions, 3 deletions
README
hshetl/connections.py
+8
-0
8 additions, 0 deletions
hshetl/connections.py
hshetl/test/unit/test_connections.py
+3
-0
3 additions, 0 deletions
hshetl/test/unit/test_connections.py
setup.py
+1
-0
1 addition, 0 deletions
setup.py
with
22 additions
and
3 deletions
README
+
10
−
3
View file @
ec07ee5c
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
hshetl/connections.py
+
8
−
0
View file @
ec07ee5c
...
...
@@ -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
This diff is collapsed.
Click to expand it.
hshetl/test/unit/test_connections.py
+
3
−
0
View file @
ec07ee5c
...
...
@@ -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
'
]
...
...
This diff is collapsed.
Click to expand it.
setup.py
+
1
−
0
View file @
ec07ee5c
...
...
@@ -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
=
[
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment