Revision 646
Added by Aaron Marcuse-Kubitza almost 13 years ago
map | ||
---|---|---|
48 | 48 |
if in_is_db or not out_is_db: usage_err() |
49 | 49 |
else: map_paths = [None] |
50 | 50 |
|
51 |
def connect_db(db_config): |
|
52 |
db = sql.connect(db_config) |
|
53 |
sys.stderr.write('Connected to '+sql.db_config_str(db_config)+'\n') |
|
54 |
return db |
|
55 |
|
|
51 | 56 |
def process_input(root, process_row, map_path): |
52 | 57 |
'''Inputs datasource to XML tree, mapping if needed''' |
53 | 58 |
# Load map header |
... | ... | |
117 | 122 |
if metadata_value(in_) == None: |
118 | 123 |
mappings[i] = (xpath.path2xml(in_root+'/'+in_), out) |
119 | 124 |
|
120 |
in_db = sql.connect(in_db_config)
|
|
125 |
in_db = connect_db(in_db_config)
|
|
121 | 126 |
in_pkeys = {} |
122 | 127 |
def get_value(in_, row): |
123 | 128 |
pkey, = row |
... | ... | |
163 | 168 |
from psycopg2.extensions import ISOLATION_LEVEL_SERIALIZABLE |
164 | 169 |
import db_xml |
165 | 170 |
|
166 |
out_db = sql.connect(out_db_config) |
|
167 |
out_db.set_isolation_level(ISOLATION_LEVEL_SERIALIZABLE) |
|
171 |
out_db = connect_db(out_db_config) |
|
168 | 172 |
out_pkeys = {} |
169 | 173 |
try: |
170 | 174 |
if test: sql.empty_db(out_db) |
Also available in: Unified diff
bin/map: Print a message when a database is successfully connected to