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():
4949 return config
5050
5151
52- def create_factdb_engine ():
52+ def create_factdb_engine (database = None ):
5353 '''
5454 returns a sqlalchemy.Engine pointing to the factdata database
5555
5656 The different hostname on isdc machines is handled correctly.
5757 '''
58+ spec = 'mysql+pymysql://{user}:{password}@{host}/{database}'
59+
5860 creds = get_credentials ()
61+ config = dict (creds ['database' ])
5962
6063 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
6468
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 33
44setup (
55 name = 'pyfact' ,
6- version = '0.8.2 ' ,
6+ version = '0.8.3 ' ,
77 description = 'A module containing useful methods for working with fact' ,
88 url = 'http://github.com/fact-project/pyfact' ,
99 author = 'Maximilian Noethe, Dominik Neise' ,
You can’t perform that action at this time.
0 commit comments