Error while importing file into DB2 from python script -
getting below error while trying import ^ delimited file db2 database using python 2.4.3.
error:
traceback (most recent call last): file "c:\python25\usefulscripts\order.py", line 89, in <module> load_order_stack() file "c:\python25\usefulscripts\order.py", line 75, in load_order_stack conn2.execute(importtmp) programmingerror: ('42601', '[42601] [ibm][cli driver][db2/linuxx8664] sql0104n unexpected token "orders_extract"was found following "import ".
code:
import pyodbc def load_order_stack(): try: conn2 = pyodbc.connect('dsn=db2database;uid=ueserid;pwd=password') importtmp = ("import orders_extract of del modified coldel0x5e" "insert_update test.orders_table (order_id,item,price);") conn2.execute(importtmp) conn2.commit()
import not sql statement. db2 command line processor (clp) command , such can run said clp.
there sql interface clp commands via calls admin_cmd() stored procedure, please check manual: import using admin_cmd
Comments
Post a Comment