I figured it out.  It's a Mistake in my postgres table.

'Error while executing the query;\nERROR:  array_in: Need to specify 
dimension',

I used varchar[50], instead of varchar(50); making
fiekds arrays.

I'm planning to get an example together
and submit it to the Python Cookbook.

Also it was pointed out to me that select * is bad thing:
   srcStmt = 'Select * from [%s]' % srcTable
I do not use 'select *' for most code.  In this case, I
wanted to get a list of all the fields from the returned
record set.


On 2001.12.27 13:40:52 -0700 Craig H . Anderson wrote:
> 
> I'm trying to transfer an access database table to Postgres.
> I have created a Postgres table with the same fields as the access 
> database.
> I'm attempting to use the fields read from the access db to set up
> parameters for insert into the Postgres db.
> I get the error and traceback shown below.
> Any suggestions on how to do this?  Thanks.
> 
> #### code fragment
> srcRs = win32com.client.Dispatch(r'ADODB.Recordset')
> srcStmt = 'Select * from [%s]' % srcTable
> srcRs.Open(srcStmt,srcConn,1,3)
> srcRs.MoveFirst()
> dstStmt = dstStmt + ')'
> dstCmd = win32com.client.Dispatch(r'ADODB.Command')
> dstCmd.ActiveConnection = dstConn
> dstCmd.Prepared = 1
> dstCmd.CommandType = win32com.client.constants.adCmdText
> dstCmd.CommandTimeout = 20
> dstCmd.CommandText = dstStmtv
> dstCmd.Execute(RecordsAffected=pythoncom.Empty,
>                  
> Parameters=parms,Options=win32com.client.constants.adCmdText)
> parms = []
> for ff in srcRs.Fields:
>       parms.append(ff) 
> 
>dstCmd.Execute(RecordsAffected=pythoncom.Empty,Parameters=parms,Options=win32com.client.constants.adCmdText)
> 
> ########### Error on Execute()
> Traceback (most recent call last):
>   File "<interactive input>", line 1, in ?
>   File "E:\FoodBank\PyTools\adoXferJet2Sql.py", line 103, in ?
>     stmt,count = xfer.xferTable(table,srcConn,dstConn)
>   File "E:\FoodBank\PyTools\adoXferJet2Sql.py", line 90, in xferTable 
> 
>dstCmd.Execute(RecordsAffected=pythoncom.Empty,Parameters=parms,Options=win32com.client.constants.adCmdText)
>   File 
> "E:\Python21\win32com\gen_py\EF53050B-882E-4776-B643-EDA472E8E3F2x0x2x7.py", 
> line 1746, in Execute
>     return self._ApplyTypes_(0x5, 1, (9, 0), ((16396, 18), (16396, 17), 
> (3, 49)), 'Execute', 
> '{00000556-0000-0010-8000-00AA006D2EA4}',RecordsAffected, Parameters, 
> Options)
>   File "E:\Python21\win32com\client\__init__.py", line 343, in 
> _ApplyTypes_
>     return self._get_good_object_(apply(self._oleobj_.InvokeTypes, 
> (dispid, 0, wFlags, retType, argTypes) + args), user, resultCLSID)
> com_error: (-2147352567, 'Exception occurred.', (0, 'Microsoft OLE DB 
> Provider for ODBC Drivers', 'Error while executing the query;\nERROR:  
> array_in: Need to specify dimension', None, 0, -2147467259), None)
> 
> 
_______________________________________________
ActivePython mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/activepython

Reply via email to