Re: [sqlalchemy] 0.9.7: Intermittently find a dead weakref to a listens_for function while checking _stored_in_collection of a registry

2015-04-03 Thread Evan James
Michael,

Thanks - sorry to have wasted your time.  It seems I gave up on Googling my 
stack trace too soon.

Thanks,
Evan James

-- 
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 http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.


[sqlalchemy] SQLAlchemy 1.0.0b5 Released

2015-04-03 Thread Mike Bayer
SQLAlchemy release 1.0.0b5 is now available.

This release is yet another set of fixes for issues reported
by beta testers.  At this point, 1.0.0 is ready to go and should
be released very soon.

In preparation for 1.0.0, production installations that haven't yet been
tested in the 1.0 series should be making sure that their requirements
files are capped at 0.9.99, to avoid surprise upgrades.

Changelog for 1.0.0b5 is at:

http://www.sqlalchemy.org/changelog/CHANGES_1_0_0b5


SQLAlchemy 1.0.0b5 is available on the Download Page:

http://www.sqlalchemy.org/download.html



-- 
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 http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.


[sqlalchemy] generating safe sqlalchemy.sql.text elements?

2015-04-03 Thread Jonathan Vanasco
I have an include file that generates a handful of timestamp clauses:

def sql_now():
return sqlalchemy.sql.text((CURRENT_TIMESTAMP AT TIME ZONE 'UTC'))

def sql_now_minus_10_minutes():
return sqlalchemy.sql.text((CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - 
INTERVAL '10 MINUTES'))

One of them needs to be driven by a configuration value :

def sql_now_minus_interval(interval):
return sqlalchemy.sql.text((CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - 
INTERVAL '%s') % lib.constants.RATELIMIT_TIMEOUT_A)


Is there anything I can do to protect myself from accidental sql injection 
?  This is all first-party code, so I'm not worried about a little bobby 
tables scenario, but am concerned with bad text getting named in the 
constant and breaking a query.

-- 
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 http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.


Re: [sqlalchemy] generating safe sqlalchemy.sql.text elements?

2015-04-03 Thread Mike Bayer


On 4/3/15 3:10 PM, Jonathan Vanasco wrote:
 I have an include file that generates a handful of timestamp clauses:

 def sql_now():
 return sqlalchemy.sql.text((CURRENT_TIMESTAMP AT TIME ZONE 'UTC'))

 def sql_now_minus_10_minutes():
 return sqlalchemy.sql.text((CURRENT_TIMESTAMP AT TIME ZONE 'UTC' -
 INTERVAL '10 MINUTES'))

 One of them needs to be driven by a configuration value :

 def sql_now_minus_interval(interval):
 return sqlalchemy.sql.text((CURRENT_TIMESTAMP AT TIME ZONE 'UTC' -
 INTERVAL '%s') % lib.constants.RATELIMIT_TIMEOUT_A)


 Is there anything I can do to protect myself from accidental sql
 injection ?  This is all first-party code, so I'm not worried about a
 little bobby tables scenario, but am concerned with bad text getting
 named in the constant and breaking a query.

is lib.constants.RATELIMIT_TIMEOUT_A a source of untrusted user input? 
If not, then it's OK.

Though in this specific case I would think you could use a bound
parameter just as well (text() supports these via :param and .bindparams()).


-- 
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 http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.


Re: [sqlalchemy] generating safe sqlalchemy.sql.text elements?

2015-04-03 Thread Jonathan Vanasco
oh, a HUGE thanks!

-- 
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 http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.


[sqlalchemy] Redshift - approximate count

2015-04-03 Thread Kristi Tsukida
Redshift supports a modifier approximate as in

SELECT APPROXIMATE COUNT(*)
FROM my_table;

Is there a way to get this with func.count()?

Thanks
-Kristi

http://docs.aws.amazon.com/redshift/latest/dg/r_COUNT.html

-- 
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 http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.


Re: [sqlalchemy] Redshift - approximate count

2015-04-03 Thread Mike Bayer
I think you can get this with select.prefix_with():

http://docs.sqlalchemy.org/en/rel_0_9/core/selectable.html?highlight=prefix#sqlalchemy.sql.expression.Select.prefix_with



On 4/3/15 8:22 PM, Kristi Tsukida wrote:
 Redshift supports a modifier approximate as in

 SELECT APPROXIMATE COUNT(*)
 FROM my_table;

 Is there a way to get this with func.count()?

 Thanks
 -Kristi

 http://docs.aws.amazon.com/redshift/latest/dg/r_COUNT.html
 -- 
 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 http://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 http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.