Revision 126
Added by Aaron Marcuse-Kubitza about 13 years ago
map | ||
---|---|---|
69 | 69 |
if map_path != None: |
70 | 70 |
doc1 = xml.dom.minidom.getDOMImplementation().createDocument(None, |
71 | 71 |
dest, None) |
72 |
if in_is_xml: raise SystemExit('XML-XML mapping not supported yet') |
|
73 |
elif in_is_db: |
|
72 |
if in_is_db: |
|
73 |
assert in_is_xml |
|
74 |
|
|
74 | 75 |
import psycopg2 |
75 |
|
|
76 | 76 |
import db_xml |
77 | 77 |
|
78 |
try: src_root = xpath.parse(src_root) |
|
79 |
except SyntaxException, ex: raise SystemExit(str(ex)) |
|
80 |
|
|
78 | 81 |
in_db = psycopg2.connect(**in_db_config) |
79 | 82 |
for in_, out in mappings: |
80 | 83 |
value = metadata_value(in_) |
81 | 84 |
if value == None: |
82 | 85 |
raise SystemExit('DB-XML mapping not supported yet') |
83 | 86 |
in_db.close() |
87 |
elif in_is_xml: raise SystemExit('XML-XML mapping not supported yet') |
|
84 | 88 |
else: # input is CSV |
85 | 89 |
metadata = [] |
86 | 90 |
map_ = {} |
... | ... | |
105 | 109 |
if out_db_config != None: # output is database |
106 | 110 |
import psycopg2 |
107 | 111 |
from psycopg2.extensions import ISOLATION_LEVEL_SERIALIZABLE |
108 |
|
|
109 | 112 |
import db_xml |
110 | 113 |
|
111 | 114 |
db = psycopg2.connect(**out_db_config) |
Also available in: Unified diff
map: Started adding database get by XPath functionality