[sqlalchemy] Re: MySQL Functions

2006-12-21 Thread saxon75


It must be something stupid on my end, then.  I'm sure I'll smack
myself when I figure it out.

Thanks for your help.

On Dec 20, 6:24 pm, Michael Bayer [EMAIL PROTECTED] wrote:

i just tried out your example and it executes fine using mysql 5, query
output is:

SELECT blog_articles.timestamp AS blog_articles_timestamp,
blog_articles.text AS blog_articles_text, blog_articles.id AS
blog_articles_id, blog_articles.title AS blog_articles_title
FROM blog_articles
WHERE year(from_unixtime(blog_articles.timestamp)) = %s ORDER BY
blog_articles.id

params: ['2006']



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: MySQL Functions

2006-12-20 Thread Michael Bayer


i dont know much about FROM_TIMESTAMP but from the MySQL docs it seems
like it deals with a UNIX_TIMESTAMP value, which perhaps is different
from an integer (although it looks like an int from the examples.
maybe its a long?).

The steps to make this work are to get it to work from your MySQL
command line first.  then use echoing in SA to insure that its
producing the identical SQL to the working string.  as a last resort,
sometimes you have to make small test programs using straight DBAPI to
insure that theres no weirdness happening with MySQLdb.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: MySQL Functions

2006-12-20 Thread saxon75


The initial query I posted definitely works--I've been using something
very much like it for a long time in my existing application.  I've
only recently discovered SA, though, and I'm trying to incorporate it
into my design.  FROM_TIMESTAMP can definitely take an integer input.

Anyway, thanks.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: MySQL Functions

2006-12-20 Thread Michael Bayer


i just tried out your example and it executes fine using mysql 5, query
output is:

SELECT blog_articles.timestamp AS blog_articles_timestamp,
blog_articles.text AS blog_articles_text, blog_articles.id AS
blog_articles_id, blog_articles.title AS blog_articles_title
FROM blog_articles
WHERE year(from_unixtime(blog_articles.timestamp)) = %s ORDER BY
blog_articles.id

params: ['2006']


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---