Thanks!

On Jan 13, 1:32 pm, Michael Bayer <mike...@zzzcomputing.com> wrote:
> The gid is fine here, its the presence of GeoAlchemy objects sent as bind 
> parameters where they're not able to be rendered as function calls inline 
> with the SQL.  You should check with the GeoAlchemy list 
> (http://groups.google.com/group/geoalchemy) with a full example of your 
> insert statement, they can show you the correct way to structure it.
>
> On Jan 13, 2011, at 2:58 PM, wilbur wrote:
>
> > Hi,
>
> > I am getting an error trying to insert records into a PostgreSQL
> > database with SQLAlchemy. My table definition:
>
> > class dream4_eta_15km_pm10(Base):
> >    __tablename__='pm10_dream_rasters'
>
> > gid=Column(Integer,Sequence('pm10_dream_rasters_gid_seq'),primary_key=True)
> >    rundate=Column(DateTime(timezone=True),nullable=False)
> >    datetime=Column(DateTime(timezone=True),nullable=False)
> >    location_raw=Column(VARCHAR,nullable=False)
> >    location_class=Column(VARCHAR,nullable=False)
> >    timezone=Column(DateTime(timezone=False),nullable=False)
> >    the_geom=GeometryColumn(Polygon(2),nullable=False)
> >    max_pm10=Column(Float,nullable=False)
> >    mean_pm10=Column(Float,nullable=False)
>
> > and, my postgresql table definition:
>
> > reason=# \d pm25_dream_rasters
> >                                         Table
> > "public.pm25_dream_rasters"
> >     Column     |              Type
> > |                            Modifiers
> > ----------------+--------------------------------
> > +------------------------------------------------------------------
> > gid            | integer                        | not null default
> > nextval('pm25_dream_rasters_gid_seq'::regclass)
> > the_geom       | geometry                       |
> > rundate        | timestamp with time zone       |
> > datetime       | timestamp with time zone       |
> > location_raw   | character varying              |
> > location_class | character varying              |
> > timezone       | timestamp(6) without time zone |
> > max_pm25       | double precision               |
> > mean_pm25      | double precision               |
> > Indexes:
> >    "pm25_dream_rasters_pkey" PRIMARY KEY, btree (gid)
> >    "pm25_24hour_select" btree (((datetime - rundate) <
> > '24:00:00'::interval))
> >    "pm25_dream_raster_timezone_idx" btree (timezone)
> > Check constraints:
> >    "enforce_dims_the_geom" CHECK (ndims(the_geom) = 2)
> >    "enforce_geotype_the_geom" CHECK (geometrytype(the_geom) =
> > 'MULTIPOLYGON'::text OR the_geom IS NULL)
> >    "enforce_srid_the_geom" CHECK (srid(the_geom) = 4326)
>
> > And I get the following error:
>
> > sqlalchemy.exc.ProgrammingError: (ProgrammingError) can't adapt
> > 'INSERT INTO pm10_dream_rasters (gid, rundate, datetime, location_raw,
> > location_class, timezone, the_geom, max_pm10, mean_pm10) VALUES (%
> > (gid)s, %(rundate)s, %(datetime)s, %(location_raw)s, %
> > (location_class)s, %(timezone)s, GeomFromText(%(GeomFromText_1)s, %
> > (GeomFromText_2)s), %(max_pm10)s, %(mean_pm10)s)' {'rundate':
> > '2011-01-10 00:00:00Z', 'location_raw': '/geodata/edac_dream/
> > eta_dream4/dream_raw_tiff/20110110/D011011_t00_pm10.tif',
> > 'GeomFromText_1': 'POLYGON((-120.000 43.833,-96.833 43.833,-96.833
> > 26.000,-120.000 26.000,-120.000 43.833))', 'location_class': '/geodata/
> > edac_dream/eta_dream4/dream_reclass_tiff/20110110/
> > D011011_t00_pm10.tif', 'datetime': '2011-01-10 00:00:00Z',
> > 'mean_pm10': 0.0, 'gid': 1372073L, 'timezone': '2011-01-10 00:00:00',
> > 'GeomFromText_2': 4326, 'max_pm10': 0.0}
>
> > I am a little concerned about the value that is being set for the
> > 'gid' variable (e.g. 1372073L). Does this simply indicate some kind of
> > long integer? Is it a possible source of my error?
>
> > Thanks, Bill
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "sqlalchemy" group.
> > To post to this group, send email to sqlalchemy@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > sqlalchemy+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/sqlalchemy?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to