Ignore:
Timestamp:
01/05/08 14:15:41 (12 years ago)
Author:
cbyrom
Message:

Add script to run ingest for all avaiable config files.
Make oai_ingest_new2 a proper object.
Adjust db_funcs - now pass in details to set up database connection

  • although defaults available, if not done.

Simplify coord parsing in PostgresRecord? by using a reusable function.
+ various tidy ups and fixes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TI01-discovery/branches/ingestAutomation-upgrade/OAIBatch/db_funcs.py

    r3817 r3839  
    33# functions for use with NDG discovery postgres db 
    44 
    5 import pgdb, logging 
     5import pgdb, logging, sys 
    66 
    7 def db_connect(): 
     7def db_connect(databaseName='discoverydb', hostName='localhost', userName='postgres', password='pass01word'): 
    88        ''' 
    99        Open a Postgres database connection 
     10        @param databaseName: Name of DB to connect to 
     11        @param hostName: Name of machine where DB is located 
     12        @param userName: Name of user to connect to DB as 
     13        @param password: Password for user  
    1014        ''' 
    11         DATABASE = 'test' 
    12         HOST     = 'localhost' 
    13         USER     = 'postgres' 
    14         PW       = 'pass01word' 
    15         SCHEMA   = 'public' 
    16         #       DATABASE = 'xxxx' 
    17         #       HOST     = 'xxx.xxx.uk' 
    18         #       USER     = 'xxx' 
    19         #       PW       = 'xxxxxxx' 
    20         #       SCHEMA   = 'xxx' 
    21         logging.info("Setting up connection to DB: " + DATABASE + " on " + HOST) 
    22         connection_string = HOST + ':' + DATABASE + ':' + USER + ':' + PW 
     15        logging.info("Setting up connection to DB: " + databaseName + " on " + hostName) 
     16        connection_string = hostName + ':' + databaseName + ':' + userName + ':' + password 
    2317        connection = pgdb.connect(connection_string) 
    2418        logging.info("DB connection established") 
Note: See TracChangeset for help on using the changeset viewer.