On 09/01/2016 01:52 PM, pyArchInit ArcheoImagineers wrote:
Hi to alls,

I have a problem with import and export real/float datatype from
postgres to spatialite and viceversa.

I have a table with some colums defined like this:
Column('skeleton_lenght', Float(2,2))

The sqlalchemy method charges the table in a Postgres DB and in a
Spatialite DB (I use on my PC spatialite, and when I can stay in office
Postgres)

On spatialite the column type Float remains Float, but in Postgres the
Column becomes Real.


Postgresql doesn't use the word "Float" to represent the type. It accepts the word "float" to create the type, but depending on precision will resolve it to REAL or DOUBLE PRECISION.

https://www.postgresql.org/docs/9.1/static/datatype-numeric.html

"PostgreSQL also supports the SQL-standard notations float and float(p) for specifying inexact numeric types. Here, p specifies the minimum acceptable precision in binary digits. PostgreSQL accepts float(1) to float(24) as selecting the real type, while float(25) to float(53) select double precision. Values of p outside the allowed range draw an error. float with no precision specified is taken to mean double precision."





On Mapper Class I use '%f' to mapping the columns and variables, and all
it's ok when I save or I update data.

BUT, when I try to import from spatialite to postgres and viceversa,
SQLALCHEMY tell me, there is an invalid sintax for real.

If I set all with Numeric, the problem doesn't appear.

What Can I do with Float type?

Best regards

Luca

--
You received this message because you are subscribed to the Google
Groups "sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to sqlalchemy+unsubscr...@googlegroups.com
<mailto:sqlalchemy+unsubscr...@googlegroups.com>.
To post to this group, send email to sqlalchemy@googlegroups.com
<mailto:sqlalchemy@googlegroups.com>.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to