dates are stored as strings,  yes.   yyyy-mm-dd format is used by sqlite.SLDate 
in sqla.   if you want yyyymmdd format for dates you should just use String() 
for the type, or TypeDecorator with String that converts Python datetime 
objects.


On Feb 25, 2011, at 12:50 AM, bool wrote:

> Here is the output after 'echo=True' is put.
> 
> I see that date values are getting stored as 'yyyy-mm-dd' format in
> sqlite (atleast that is what is getting printed using echo=True).
> 
> And when I use 'yyyymmdd' format in my view creation it produces wrong
> results. However if I use 'yyyy-mm-dd' I seem to get correct results.
> 
> Shouldn't these formats be handled properly? Or am I missing
> something?
> 
> 
> 
> ===================================================================================================================
> [20110225 11:09:11:127 base.py:945 INFO] PRAGMA table_info("y")
> [20110225 11:09:11:128 base.py:946 INFO] ()
> [20110225 11:09:11:141 base.py:945 INFO]
> CREATE TABLE y (
>        z VARCHAR,
>        d DATE
> )
> 
> 
> [20110225 11:09:11:141 base.py:946 INFO] ()
> [20110225 11:09:11:149 base.py:745 INFO] COMMIT
> [20110225 11:09:11:150 base.py:945 INFO] INSERT INTO y (z, d) VALUES
> (?, ?)
> [20110225 11:09:11:150 base.py:946 INFO] ['a', '2011-02-10']
> [20110225 11:09:11:154 base.py:745 INFO] COMMIT
> [20110225 11:09:11:158 base.py:945 INFO] SELECT y.z, y.d
> FROM y
> [20110225 11:09:11:158 base.py:946 INFO] []
> (u'a', datetime.date(2011, 2, 10))
> [20110225 11:09:11:161 base.py:945 INFO] CREATE TEMP VIEW myview AS
> SELECT y.z, y.d
> FROM y
> WHERE y.d > '20110310'
> [20110225 11:09:11:161 base.py:946 INFO] ()
> [20110225 11:09:11:161 base.py:745 INFO] COMMIT
> [20110225 11:09:11:162 base.py:945 INFO] PRAGMA table_info(myview)
> [20110225 11:09:11:162 base.py:946 INFO] ()
> [20110225 11:09:11:163 base.py:945 INFO] PRAGMA
> foreign_key_list(myview)
> [20110225 11:09:11:163 base.py:946 INFO] ()
> [20110225 11:09:11:163 base.py:945 INFO] PRAGMA index_list(myview)
> [20110225 11:09:11:163 base.py:946 INFO] ()
> [20110225 11:09:11:163 base.py:945 INFO] SELECT myview.z, myview.d
> FROM myview
> [20110225 11:09:11:163 base.py:946 INFO] []
> (u'a', datetime.date(2011, 2, 10))
> 
> -- 
> 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.
> 

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