Thanks Anthony for your time and answers, I will use another tool for
this project then, the DB already exist with the "Identifying
Relationship" structure and I can't change it.
Greetings.
El 06/07/16 a las 12:21, Anthony escribió:
On Wednesday, July 6, 2016 at 8:39:57 AM UTC-4, Carlos Cesar Caballero
wrote:
Hi Anthony, that's exactly what I need, because (among other
things) when the parent key is part of the child primary key I can
do something like child.parent_id, and it works the same with a
relationship of depth n, for example in the relation
author-book-page-sentence-word, I can ask what author wrote a word
just saying word.author_id without need to join word with sentence
with page with book to get the author id.
Yes, but nothing stops you from doing that with the DAL:
|
db.define_table('word',
Field('sentence_id','reference sentence'),
Field('page_id','reference page'),
Field('book_id','reference book'),
Field('author_id','reference author'),
Field('word'))
word =db.word(1)
author_id =word.author_id
|
In the above, db.word.author_id is not part of the primary key of the
db.word table, but it is still a foreign key to the db.author table.
But keep in mind that this is not that useful, as all you have is the
record ID of the author -- if you want any details about the author,
you still need to do a join or an additional query.
Anthony
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google
Groups "web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to web2py+unsubscr...@googlegroups.com
<mailto:web2py+unsubscr...@googlegroups.com>.
For more options, visit https://groups.google.com/d/optout.
--
Este mensaje le ha llegado mediante el servicio de correo electronico que
ofrece Infomed para respaldar el cumplimiento de las misiones del Sistema
Nacional de Salud. La persona que envia este correo asume el compromiso de usar
el servicio a tales fines y cumplir con las regulaciones establecidas
Infomed: http://www.sld.cu/
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups "web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.