newbie: Need Help Moving Data from Kirbybase to Gadfly

dc cncprgr at aim.com
Mon Apr 10 11:31:01 EDT 2006


I am fairly new to python and SQL. I have been trying to move data from
Kirbybase table to a Gadfly table and cannot get it to work. Win XP
with python 2.4, Kirbase 1.9, Gadfly B5.

Complete script shown here, with python traceback.

#   get global modules for python
import os
import sys

#get database manager module
from kirbybase import KirbyBase, KBError

# open a database, embedded
db = KirbyBase()
result=db.select('test2.tbl', ['recno'],['*'], returnType='object')

# open Gadfly database for storing data
import gadfly
connection = gadfly.gadfly()
connection.startup("subscription", "pvfd_sql")
cursor = connection.cursor()

# Insert all records into SQL Database
for record in result:
   sql="INSERT INTO addresslist (lastname, firstname, address, city,
state, zip_code, phone) VALUES(?, ?, ?, ?, ?, ?, ?)"
   cursor.execute(sql,result)
   connection.commit()
connection.close

#------------------------------------------------------------------------------
#  End of Script
#------------------------------------------------------------------------------



Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)]
on win32
Type "copyright", "credits" or "license()" for more information.

   ****************************************************************
   Personal firewall software may warn about the connection IDLE
   makes to its subprocess using this computer's internal loopback
   interface.  This connection is not visible on any external
   interface and no data is sent to or received from the Internet.
   ****************************************************************
   IDLE 1.1.2      ==== No Subprocess ====
>>>
Traceback (most recent call last):
 File "C:\Documents and Settings\timothy volner\Desktop\puryear\move
records to sql.py", line 30, in ?
   cursor.execute(sql,result)
 File "C:\Python24\lib\site-packages\gadfly\database.py", line 367, in
execute
   cs[i] = cs[i].relbind(database)
 File "C:\Python24\lib\site-packages\gadfly\operations.py", line 601,
in relbind
   target = self.target = db.get_for_update(name)
 File "C:\Python24\lib\site-packages\gadfly\store.py", line 201, in
get_for_update
   test = rels[name]
 File "C:\Python24\lib\site-packages\gadfly\store.py", line 1043, in
__getitem__
   return self.shadow[key]
KeyError: 'ADDRESSLIST'
>>>
	
No matter what I do to data, I always end up with this error.




More information about the Python-list mailing list