Its possible that SQLite doesn't respect the "scale" argument.  I'd look
at the full SQL generated to ensure its what you'd expect, then check
sqlite's documentation on this.


Thomas wrote:
>
> Hi,
>
> I am a new sqlalchemy user. I'm a bit confused by the behavior of the
> Numeric data type. Consider the following code:
>
> from sqlalchemy import *
>
> db = create_engine('sqlite:///test.db')
> metadata = MetaData()
> table = Table('thetable',metadata,Column('x',Numeric(scale=3)),Column
> ('y',Float))
> metadata.create_all(db)
>
> a = 300.155555
>
> c = db.connect()
> c.execute(table.insert(),{'x':a,'y':a})
> c.close()
>
> Now inspecting the database:
>
> valinor:sqlalchemy tom$ sqlite3 test.db
> SQLite version 3.4.0
> Enter ".help" for instructions
> sqlite> select * from thetable;
> 300.155555|300.155555
>
> Should the first column not be 300.156 since I specified scale=3? Am I
> doing something wrong?
>
> Thanks for any help,
>
> Thomas
>
> >
>


--~--~---------~--~----~------------~-------~--~----~
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