OK, to answer my own query this works fine:
--
class User(object):
username_enc = Column(String(128))
@hybrid_attribute
def username(self):
return decrypt_string(self.username_enc)
@username.setter
def
Just found this useful page with an example:
http://www.sqlalchemy.org/trac/wiki/UsageRecipes/SymmetricEncryption
Not 100% sure what is going on with a class being defined within the
Model class itself, but I'll have a play around and see where I can
get to with that.
Thanks.
On May 2, 5:33 pm,
Hi All,
I am trying to write a model that will encrypt all data at the
database level, but can be accessed easily through normal attributes.
I stumbled across the hybrid_property feature and it works fine, as
long as I don't try and filter() or filter_by() my hybrid_property.
The thing is it'd be
Hi Michael,
Thank you for the quick answer. I'll switch to subqueryload.
Andrei
On Wed, May 2, 2012 at 4:55 PM, Michael Bayer wrote:
> this is not really a built-in SQLAlchemy feature so the quick thing I can
> advise is to use subqueryload() instead, which makes use of Query to get at
> the re
this is not really a built-in SQLAlchemy feature so the quick thing I can
advise is to use subqueryload() instead, which makes use of Query to get at the
related "pets" collection, rather than appending to the query directly as
joinedload does. Your other option would be to use a custom primary
Hello,
A couple of months ago I was asking on the list about a query class that
could support a "deleted_at" attribute for the models, such as when a
object it's deleted, the statement it's transformed into an update with the
field set to a certain date. Just now I noticed that my class is not
fri
On May 2, 2012, at 8:34 AM, Moritz Schlarb wrote:
> Thank you, Michael!
>
> But could I achieve it somehow using hybrid properties and a case statement?
>
> I tried something like:
>
> @hybrid_property
> def time(self):
> return self._time or self.event.time
>
> @time.
Thank you, Michael!
But could I achieve it somehow using hybrid properties and a case statement?
I tried something like:
@hybrid_property
def time(self):
return self._time or self.event.time
@time.expression
def time(cls):
return case([(cls._time != None, cls
Nope, just use the one inside the scope, TagMixin.TagClass, like so for your
example:
session.add(User.TagClass(tagged=doc1,name='foo'))
On May 2, 2012, at 5:07 AM, Ciaran Farrell wrote:
> But how would you actually add a tag? For example, say, using the example you
> provided below, I had
But how would you actually add a tag? For example, say, using the example
you provided below, I had a table called Document, which has is 'taggable'.
If I create a Document object (doc1), I can see doc1.tags, which is a list.
However, how do I actually _add_ a tag to doc1? I have a TagMixin obje
10 matches
Mail list logo