File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -49,17 +49,21 @@ def get_credentials():
49
49
return config
50
50
51
51
52
- def create_factdb_engine ():
52
+ def create_factdb_engine (database = None ):
53
53
'''
54
54
returns a sqlalchemy.Engine pointing to the factdata database
55
55
56
56
The different hostname on isdc machines is handled correctly.
57
57
'''
58
+ spec = 'mysql+pymysql://{user}:{password}@{host}/{database}'
59
+
58
60
creds = get_credentials ()
61
+ config = dict (creds ['database' ])
59
62
60
63
if socket .gethostname ().startswith ('isdc' ):
61
- spec = 'mysql+pymysql://{user}:{password}@lp-fact/{database}'
62
- else :
63
- spec = 'mysql+pymysql://{user}:{password}@{host}/{database}'
64
+ config ['host' ] = 'lp-fact'
65
+
66
+ if database is not None :
67
+ config ['database' ] = database
64
68
65
- return create_engine (spec .format (** creds [ 'database' ] ))
69
+ return create_engine (spec .format (** config ))
Original file line number Diff line number Diff line change 3
3
4
4
setup (
5
5
name = 'pyfact' ,
6
- version = '0.8.2 ' ,
6
+ version = '0.8.3 ' ,
7
7
description = 'A module containing useful methods for working with fact' ,
8
8
url = 'http://github.com/fact-project/pyfact' ,
9
9
author = 'Maximilian Noethe, Dominik Neise' ,
You can’t perform that action at this time.
0 commit comments