🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.python
Article #27296

Re: sqlalchemy - property

#27296
From: janosikowy
Date: Thu, 11 Feb 2010 11:42
26 lines
2014 bytes
Piotr Husiatynski <husio@gmail.com> napisał(a): 

> 
> `User` to klasa? Bo wyżej napisałeś `Account`. Jeśli to to samo, to zauważ
> , że
> `User` jest obiektem typu klasa (nie jej instancją).
> 
Kod jest przykładowy, pisany na żywca i oczywiście się walnąłem ;)
Poprawne prawidłowe zapytania:
Session.query(Account.name).distinct() 
Session.query(Account).filter(Account.name=='j.kowalski')

Niestety deskryptory nadal nie działają tak jak to sobie wyobrażałem.
Trochę się zagłębiam w dokumentację i jestem lekko zagubiony.
Niby jest mowa o 'custom comparatorach', co chyba rozwiąże mój problem,
jednak cytując dokumentację:
http://www.sqlalchemy.org/docs/05/mappers.html#using-descriptors
"The email attribute is now usable in the same way as any other mapped
attribute, including filter expressions, get/set operations, etc.:"

Getter/Setter działa tak jak przewidywałem.
W Query descriptor zwraca mi zawsze wartość z bazy, atrbuty nie podlegają
modyfikacji getterem.

-- 
Wysłano z serwisu Usenet w portalu Gazeta.pl -> http://www.gazeta.pl/usenet/
Technical Details
Message-ID: <hl0qe8$fit$1@inews.gazeta.pl>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.rmf.pl!agh.edu.pl!news.agh.edu.pl!news.onet.pl!news.nask.pl!news.nask.org.pl!newsfeed.pionier.net.pl!news.gazeta.pl!not-for-mail
References: <hkvl8b$66h$1@inews.gazeta.pl> <slrnhn763b.5e5.husio@oceanic.wsisiz.edu.pl>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.rmf.pl!agh.edu.pl!news.agh.edu.pl!news.onet.pl!news.nask.pl!news.nask.org.pl!newsfeed.pionier.net.pl!news.gazeta.pl!not-for-mail
From: " " <janosikowy@WYTNIJ.gazeta.pl>
Newsgroups: pl.comp.lang.python
Subject: Re: sqlalchemy - property
Date: Thu, 11 Feb 2010 11:42:00 +0000 (UTC)
Organization: "Portal Gazeta.pl -> http://www.gazeta.pl"
Lines: 26
Message-ID: <hl0qe8$fit$1@inews.gazeta.pl>
References: <hkvl8b$66h$1@inews.gazeta.pl> <slrnhn763b.5e5.husio@oceanic.wsisiz.edu.pl>
NNTP-Posting-Host: localhost
X-Trace: inews.gazeta.pl 1265888520 15965 172.20.26.242 (11 Feb 2010 11:42:00 GMT)
X-Complaints-To: usenet@agora.pl
NNTP-Posting-Date: Thu, 11 Feb 2010 11:42:00 +0000 (UTC)
X-User: janosikowy
X-Forwarded-For: 194.106.193.203
X-Remote-IP: localhost
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit