Basic gadfly question

Steve Holden sholden at holdenweb.com
Tue Jun 12 00:06:56 EDT 2001


"W. Jarrett Campbell" <jarrett at engineer.com> wrote in message
news:9e6V6.15027$lq1.4843531 at typhoon.austin.rr.com...
> I'm new to the world of Python, Databases, and SQL but it has been a fun
> adventure so far!
>
> I have basic question regarding the Gadfly package.  I'm working with the
> sample database generated by the gftest.py module.  I'm trying to execute
an
> SQL statement such as:
>
> INSERT INTO frequents (DRINKER, BAR) values ('Jarrett', 'cheers')
>
> When I do this I get an error back saying that I did not define a value
for
> the column 'PERWEEK'
>
> My questions are these?  Do you have to set all values in the insert
> statement or is there some way around this?  Is this bad database
> programming form to want to set only some fields?  Is this related to
gadfly
> not supporting Null values?

SQL allows the use of a "NOT NULL" constraint which forces a particular
column to contain a value. Gadfly can't (yet) handle NULL values, so each
column of each row must hold a value. In general it isn't necessarily sinful
to build databases holding NULL values, but the whole NULL idea, bringing
triple-valued logic in tow as it does, is full of pitfalls for the unwary.

>
> When using the ODBC package in the win32all distribution, I can achieve
this
> functionality with MS Access databases.  I wanted to stick with gadfly to
> remain platform independent and not require my users to purchase Access.
> Any advice?
>
You may find that you can use a null string ("") to represent no value. A
lot depends on the application. As a matter of interest you can download
enough of the Jet engine to establish ODBC data sources without having to
buy and load Access itself. Jat, and also the MSDE engine, which IIRC comes
as a part of the Office suite and also as a part of VisualStudio, can be
freely redistributed if you have the right license.

Thanks to Alex Martelli for pointing some of this out to me.

regards
 Steve





More information about the Python-list mailing list