Great. Of course that line ( |    verificationTokenExpiry =
Column(String)) was a copy and paste mistake.

On Jun 24, 10:28 am, Michael Bayer <mike...@zzzcomputing.com> wrote:
> On Jun 24, 2011, at 1:26 PM, Arthur Kopatsy wrote:
>
> > Awesome.
>
> > Does that mean the sqlalchemy example is wrong. It currently has:
> >        if callable(value):
> >            value = value()
>
> yeah thats out of date, usage  was changed in 0.7.
>
> > Should it be something like that?
>
> >        if value == None and bind.callable !=
> > None:
> > |    verificationTokenExpiry = Column(String)
> >            value = bind.callable()
>
> > Thank you so much for the quick response.
>
> yup....we had the same issue with beaker ill have to update this example
>
>
>
>
>
>
>
>
>
> > Arthur
>
> > On Jun 24, 10:05 am, Michael Bayer <mike...@zzzcomputing.com> wrote:
> >> On Jun 24, 2011, at 12:49 PM, Arthur Kopatsy wrote:
>
> >>> Hi,
>
> >>> I am trying to write a proper query_chooser method for our user based
> >>> sharding. To do so, I need to be able to query the value of the
> >>> query's criterions.
>
> >>> I have the following model:
> >>> class User(object):
> >>>    id = Column(Integer, primary_key=True)
> >>>    ...
>
> >>> class Subscription(object):
> >>>    id = Column(Integer, primary_key=True)
> >>>    producerId = Column(Integer, ForeignKey('User.id'))
> >>>    consumerId = Column(Integer) # No foreign key because sharded on
> >>> producerId
> >>>    producer = relationship('User', backref='subscriptions')
>
> >>> In my query_chooser, I am using the code from the attribute_sharding
> >>> example and try to find out the value of producerId if there is such a
> >>> criterion.
>
> >>> Given an existing myUser instance and a session, I see two different
> >>> behaviors:
>
> >>> 1. session.query(Subscription).filter(Subscription.producerId ==
> >>> myUser.id).all()
>
> >>> I will get a proper value for producerId in the dictionary of bound
> >>> parameters so I can find out the shard, no problem.
>
> >>> SELECT "InboundSubscription".s9id AS "InboundSubscription_s9id",
> >>> "InboundSubscription".active AS "InboundSubscription_active",
> >>> "InboundSubscription"."createdAt" AS "InboundSubscription_createdAt",
> >>> "InboundSubscription"."updatedAt" AS "InboundSubscription_updatedAt",
> >>> "InboundSubscription"."followerId" AS
> >>> "InboundSubscription_followerId", "InboundSubscription"."producerId"
> >>> AS "InboundSubscription_producerId", "InboundSubscription".status AS
> >>> "InboundSubscription_status", "InboundSubscription".suspended AS
> >>> "InboundSubscription_suspended"
> >>> FROM "InboundSubscription"
> >>> WHERE "InboundSubscription"."producerId" = :producerId_1
>
> >>> 2. myUser.subscriptions
>
> >>> I get a None value for the anonymous parameter which prevents me from
> >>> picking a shard.
>
> >>> SELECT "InboundSubscription".s9id AS "InboundSubscription_s9id",
> >>> "InboundSubscription".active AS "InboundSubscription_active",
> >>> "InboundSubscription"."createdAt" AS "InboundSubscription_createdAt",
> >>> "InboundSubscription"."updatedAt" AS "InboundSubscription_updatedAt",
> >>> "InboundSubscription"."followerId" AS
> >>> "InboundSubscription_followerId", "InboundSubscription"."producerId"
> >>> AS "InboundSubscription_producerId", "InboundSubscription".status AS
> >>> "InboundSubscription_status", "InboundSubscription".suspended AS
> >>> "InboundSubscription_suspended"
> >>> FROM "InboundSubscription"
> >>> WHERE :param_1 = "InboundSubscription"."producerId"
>
> >>> When is this value populated? How can I access it in query_chooser?
>
> >> The bindparam() object should have a "callable" attribute - call that to 
> >> get the value.    These values are late-bound when using lazyloading.
>
> > --
> > 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 
> > athttp://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