[DB-SIG] Creating Visual FoxPro tables using ODBC
Bob Gailer
ramrom@earthling.net
Thu, 02 Jan 2003 11:58:23 -0700
--=======2027515C=======
Content-Type: text/plain; x-avg-checked=avg-ok-10AD26B1; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 8bit
More background: I'm converting VFP programs to Python. Table creation and
manipulation is native to VFP, so my program often includes SQL to create
and then manipulate temporary tables. To convert to Python and continue
using this strategy requires creating and populating temporary tables using
ODBC, and seems like result will be very inefficient if I have to Create
and then Insert insert insert .... That's why I wanted to use the VFP
"select .... into table" which would do it all in one step.
I am experimenting replacing SQL with Python operations:
cursor.execute("""last_name, first_name, studentid, val(s1.score) as pre,
val(s2.score) as post, etc """)
tbl1 = cursor.fetchall()
# SQL: select count(*) as moved, pre, post from tbl1 where post > pre group
by pre
t = [s[3] for s in tbl1 if s[3] > s[4]] # pre, where post > pre
t.sort() # group by pre
and am experimenting with a function in the comprehension applied to s[3]
to accumulate the count(*) in a dictionary.
I also realize that I might have the best of both worlds by using some
other data base (MySQL?) that supports the operations I want to use and has
a good Python API. Any suggestions.
Also is there any Python-based GUI for examining and editing table contents
somewhat like VFP browse?
Bob Gailer
mailto:ramrom@earthling.net
303 442 2625
--=======2027515C=======
Content-Type: text/plain; charset=us-ascii; x-avg=cert; x-avg-checked=avg-ok-10AD26B1
Content-Disposition: inline
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.431 / Virus Database: 242 - Release Date: 12/17/2002
--=======2027515C=======--