Richard Gerd Kuesters | Pollux rich...@pollux.com.br wrote:
hi all!
i'm dealing with a little problem here. i have a parent table and its two
inheritances. there is a value that both children have and must be unique
along either types. is there a way to move this column to the parent
Andrew Millspaugh millspaugh.and...@gmail.com wrote:
I've got a class hierarchy that looks something like this:
[ A ] 1* [ B ] 1-* [ C ] 1--* [ D ] 10..1 [ E
] 1..*--0..1 [ F ]
orgprojticketsnap
Cyril Scetbon cscet...@gmail.com wrote:
I've already tried. But when I try to define a listener it says the user
attribute does not exist on Address which is true as it's not defined. I
suppose there is a time when it's defined (hen the relationship is actually
auto-generated) and maybe
the “user” backref here is a relationship() like any other, just specify
Address.user as the target of the event.
Cyril Scetbon cscet...@gmail.com wrote:
Hi,
Is there a way to add an event listener on a backref ?
I have something like :
class User(Base):
__tablename__ = 'user'
hi all!
i'm dealing with a little problem here. i have a parent table and its
two inheritances. there is a value that both children have and must be
unique along either types. is there a way to move this column to the
parent and use a constraint in the child? my implementation is postgres
I've already tried. But when I try to define a listener it says the user
attribute does not exist on Address which is true as it's not defined. I
suppose there is a time when it's defined (hen the relationship is actually
auto-generated) and maybe it's just the location of the event which is
Update.
MySQL-python = 1.2.5 - works
MySQL-python 1.2.3 - not work
MySQL-python 1.2.4 - maybe, not tested.
2015 m. kovas 23 d., pirmadienis 16:45:48 UTC+2, Edgaras Lukoševičius rašė:
Hello,
as I'm not receiving any responses in stackoverflow I wil try here. Can
someone help me with this
Yes, I got the style from there.
I have a great great great great grandchild that I need to be able to
access by the great great great great grandparent id. How would you
recommend doing that, then? I don't want to have to write f_instances =
are these two separate constraints? I just looked and it seems like they are
distinct.
I just added a fix to 1.0 because someone was hacking around something similar
to this.
The easiest way to get these for the moment is just to create the
UniqueConstraint outside of the class definition.
thanks again, Mike!
just a question: to make the constraint in the parent, shouldn't i move
other columns that composes the constraint to the parent too?
cheers,
richard.
On 03/24/2015 10:33 AM, Michael Bayer wrote:
Richard Gerd Kuesters | Pollux rich...@pollux.com.br wrote:
hi all!
Because I also want to be able to go the other way. I want to be able to
get the a attribute from any given F.
On Tuesday, March 24, 2015 at 4:47:42 PM UTC-7, Michael Bayer wrote:
Andrew Millspaugh millspau...@gmail.com javascript: wrote:
Yes, I got the style from there.
I have a
Andrew Millspaugh millspaugh.and...@gmail.com wrote:
Yes, I got the style from there.
I have a great great great great grandchild that I need to be able to access
by the great great great great grandparent id. How would you recommend doing
that, then? I don't want to have to write
greetings,
i have a project of transferring everything from an old API to a new one.
the new API uses sqlalchemy ORM exclusively and my old used raw sql with
the py-postgresql driver. i need help converting some of the more complex
statements into ORM, or at least into a textual statement with
Thanks very much Mike.
On Monday, March 23, 2015 at 12:40:46 PM UTC-4, Michael Bayer wrote:
Kent jkent...@gmail.com javascript: wrote:
In cases where we interact with the database session (a particular
Connection) to, for example, obtain an application lock which is checked
out from
My examples I just gave were actually wrong. Let me rewrite them:
*Case 1 (using relationships with composite secondary joins):*
Sub case 1: Given an instance of F, called 'f', perform some action based
on the 'a' property:
if current_user.authorized(f.a):
# do something
Sub case 2: Given
I have a situation where I can have an arbitrary number of subqueries that
need to be joined on the last step, except if the number of queries, n, is
1.
For example, for n = 1, suppose I have a complex query set to the variable
A[1]
The final submitted query would then look like:
It's more of a convenience thing. I want a nice way to be able to do
something like:
A.fs
or
F.a
For example, if a user is only allowed to modify an F object if they have a
key for the corresponding a object, I'd like to write something like:
if current_user.authorized(F.a):
# do something
Andrew Millspaugh millspaugh.and...@gmail.com wrote:
I'm pretty inexperienced with SQLAlchemy. I mostly want to know the best way
to deal with a relationship like this. I am trying to avoid adding a fake
relationship directly between F and A, as it could get out of sync with the
actual
Andrew Millspaugh millspaugh.and...@gmail.com wrote:
Because I also want to be able to go the other way. I want to be able to get
the a attribute from any given F.
well, then you’d put one on F also.
if you want to send working code and SQL we can see what’s wrong with the
relationship
any reason why you're not building a query like this?
query = db.session.query(label('sid',
distinct(a[1].c.patient_sid)))
if n = 2
query = query.\
join(a[2],a[2].c.patient_sid==a[1].c.patient_sid)
if n = 3
query = query.\
Awesome. This was the answer I was really looking for. Thank you.
I'll probably hide the relationship with python for now (I'll look into
association proxies as well) and wait until it's slow enough to bother
anyone before trying to optimize the sql. Trying to use these secondary
composite
The is_deleted column is in the User table. If possible I'd rather avoid
having to replicate it in the favorite tables (hard-deleting favorites is
fine, I only need soft deletion for users).
--
You received this message because you are subscribed to the Google Groups
sqlalchemy group.
To
Hi,
I have the following models for a favorite system:
https://gist.github.com/ThiefMaster/e4f622d54c74ee322282
Now I'd like to restrict the relationship that's created by the backref in
L24, so it doesn't include any favorited users which have the is_deleted
column set to true.
I tried
ThiefMaster adr...@planetcoding.net wrote:
The is_deleted column is in the User table. If possible I'd rather avoid
having to replicate it in the favorite tables (hard-deleting favorites is
fine, I only need soft deletion for users).
the column can be on either side.
I think maybe you
@declared_attr
def user(cls):
The user owning this favorite
return db.relationship(
'User',
lazy=False,
foreign_keys=lambda: [cls.user_id],
backref=db.backref(
'_favorite_users',
lazy=True,
Ignore the annotations below the model...those correspond to the actual
names but I forgot to remove them.
On Tuesday, March 24, 2015 at 1:12:24 AM UTC-7, Andrew Millspaugh wrote:
I've got a class hierarchy that looks something like this:
[ A ] 1* [ B ] 1-* [ C ] 1--*
Adrian adr...@planetcoding.net wrote:
@declared_attr
def user(cls):
The user owning this favorite
return db.relationship(
'User',
lazy=False,
foreign_keys=lambda: [cls.user_id],
backref=db.backref(
ThiefMaster adr...@planetcoding.net wrote:
Hi,
I have the following models for a favorite system:
https://gist.github.com/ThiefMaster/e4f622d54c74ee322282
Now I'd like to restrict the relationship that's created by the backref in
L24, so it doesn't include any favorited users which
Hi,
Is there a way to add an event listener on a backref ?
I have something like :
class User(Base):
__tablename__ = 'user'
id = Column(Integer, primary_key=True)
name = Column(String)
addresses = relationship(Address, backref=user)
class Address(Base):
__tablename__ =
I've got a class hierarchy that looks something like this:
[ A ] 1* [ B ] 1-* [ C ] 1--* [ D ] 10..1 [
E ] 1..*--0..1 [ F ]
orgprojticketsnap
bidlimit ticketset
And I'm
30 matches
Mail list logo