[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:46:44 -0800 (PST)

Hi All,

First off, thanks for ORM!  I had to develop something like it before from
scratch (nothing as comprehensive as orm) so I can really appreciate the
work you've already done!  Also, I enjoy using it.

I am putting myself through an exercise of learning both ORM and wxPython
by converting my business administration database to wxPython and ORM.
I started out with ORM 0.4.2.  It was working well until I tried to commit
some data of type "numeric."  In 0.4.2 the numeric column and datatype
classes were incomplete and I was receiving errors when I'd try to commit
the data to postgres.  So, I just downloaded the latest ORM (0.7) and have
made the necessary changes to my import statements to accomodate the new
package structure (MySQL support, YAY!).  I ran into a couple more
problems, so I subscribed to the mailing lists and found your cvs and
downloaded it.  I'm still having a bit of trouble with "numeric" data:

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")}

Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.