Thank you so much Simon, your last suggestion solved it - You helped me so
much - Its working :)

On Tue, Feb 24, 2015 at 4:24 PM, Simon King <si...@simonking.org.uk> wrote:

> What happens if you replace
>
>     join(clips_table.Clips)
>
> with
>
>     join(signals_table.Signals.clips)
>
> ie. telling SQLAlchemy to use the predefined relationship between
> Signals and Clips as the join condition.
>
> On Tue, Feb 24, 2015 at 12:35 PM, eli rashlin <eli.rash...@gmail.com>
> wrote:
> > I'm Sorry Simon - wrong query...
> >
> > This is the query that gives me the error
> >
> > query_obj = engine.query(signals_table.Signals.sig_value,
> >
> > signals_table.Signals.exist_in_frames,
> >
> > signals_table.Signals.local_frames,
> >
>  clips_table.Clips.clip_name).\
> >                                       join(clips_table.Clips).\
> >
> > filter(signals_table.Signals.message_id == msg_id).\
> >
>  filter(signals_table.Signals.signal_id
> > == sig_id).\
> >
> > filter(func.format(signals_table.Signals.sig_value, 2) ==
> > func.format(sig_val, 2)).\
> >
> > order_by(signals_table.Signals.sig_value)
> >
> >
> > On Tuesday, February 24, 2015 at 1:09:12 PM UTC+2, Simon King wrote:
> >>
> >> I'm not sure I understand - the line you've shown doesn't include any
> >> joins between Signals and Clips, so I don't know why that error would
> >> occur.
> >>
> >> In general, if you are seeing that error message, then you need to
> >> explicitly tell SQLAlchemy the join condition between the 2 tables.
> >> This is normally done using the "primaryjoin" parameter when defining
> >> the relationships.
> >>
> >> If you are getting the error at query time and you really *are*
> >> performing a join, you can specify the join condition at that time as
> >> well:
> >>
> >>
> >>
> http://docs.sqlalchemy.org/en/rel_0_9/orm/tutorial.html#querying-with-joins
> >>
> >> Hope that helps,
> >>
> >> Simon
> >>
> >> On Tue, Feb 24, 2015 at 7:56 AM, eli rashlin <eli.r...@gmail.com>
> wrote:
> >> > Thanks Simon for your replay.
> >> > when I'm removing the FK definition from the Column - The tables are
> >> > being
> >> > built as they should - the ptoblem is when i try to perform a join I'm
> >> > getting the following error:
> >> >
> >> > Can't find any foreign key relationships between 'Signals' and
> 'Clips'.
> >> >
> >> > and this is the code:
> >> >
> >> >
> >> > return engine.query(func.count(signals_table.Signals.sig_value)).\
> >> > filter(signals_table.Signals.message_id == msg_id).\
> >> > filter(signals_table.Signals.signal_id == sig_id).\
> >> > filter(func.format(signals_table.Signals.sig_value, 2) ==
> >> > func.format(sig_val, 2)).\ first()[0]
> >> >
> >> >
> >> > and this is the definition of the class Clips:
> >> > from datetime import datetime from sqlalchemy import * from
> >> > sqlalchemy.orm
> >> > import relationship from BaseCoverRuns import Base class Clips(Base):
> >> > __table_args__ = { 'mysql_engine': 'MyISAM', 'mysql_charset': 'utf8' }
> >> > __tablename__ = 'Clips' id = Column(Integer, autoincrement=True,
> >> > primary_key=True) clip_name = Column(String(255)) def
> >> > get_table_orm_def(self): return self.__table__ def __init__(self,
> >> > clip_name=None): self.clip_name = clip_name def __repr__(self): return
> >> > "<Clips ('%s')>" % (self.clip_name)
> >> >
> >> > --
> >> > 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+...@googlegroups.com.
> >> > To post to this group, send email to sqlal...@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.
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "sqlalchemy" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/sqlalchemy/Qp5j77Tz4wU/unsubscribe.
> To unsubscribe from this group and all its topics, 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.
>

-- 
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.

Reply via email to