[orm-devel] Introduction, thanks and a couple of comments on the 0.7 release

Eric Walstad orm-devel@mailman.tux4web.de
Thu, 5 Dec 2002 15:59:04 -0800 (PST)


The tail of my message was cut off.  I'll append it here...
--- Eric Walstad <ewalstad@yahoo.com> wrote:
> Hi All,
[snip]
> psycopg.ProgrammingError: ERROR: parser: parse error at or near "=<"
> UPDATE projects SET job_number='2002-057', [snip other columns],
> bid_price=<orm.columns._float instance at 0x8d5a5bc>, city='San
> Francisco'
> WHERE id=315
> 
> As you can see, the "Bid Price" float is not getting converted correctly
> and therefore the SQL is invalid.  I dug around a bit in orm/columns.py
> ->
> _numerical.convert() method, but didn't see anything there.
> 
> Here's the SQL used to create the table:
> CREATE TABLE "projects" (
> 	"id" integer DEFAULT nextval('"projects_id_seq"'::text) NOT NULL,
> 	"contacts_id" integer,
> 	"job_number" character varying(20),
> 	"project_date" timestamp without time zone DEFAULT now(),
> 	"name" character varying(50),
> 	"address" character varying(50),
> 	"city" character varying(50),
> 	"state" character(2) DEFAULT 'CA',
> 	"zip" character varying(50),
> 	"project_type" character varying(50),
> 	"bid_price" numeric(8,2),
> 	Constraint "projects_pkey" Primary Key ("id")
> );
> 
> And here's the corresponding dbclass constructor:
> class projects(dbclass):
>     columns = { "id"           :integer(),
>                 "contacts_id"  :integer(),
>                 "job_number"   :varchar(),
>                 "project_date" :timestamp(),
>                 "name"         :varchar(),
>                 "address"      :varchar(),
>                 "city"         :varchar(),
>                 "state"        :char(),
>                 "zip"          :varchar(),
>                 "project_type" :varchar(),
>                 "bid_price"    :float(),
>                 "invoices"     :one2many(invoices, "project_id")}

I'd like to be able to do:
"bid_price"  :numeric(),
but there is no numeric type around line 546 in orm/columns.py, which I'm
guessing would look like:
# float point quantities
float, floatColumn = _float, _floatColumn
numeric, numericColumn = _float, _floatColumn

Any pointers would be appreciated.

Best regards and thanks again,

Eric Walstad,
San Francisco


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com