yes.
On Tuesday, 1 January 2013 21:41:17 UTC-6, Alex Glaros wrote:
>
> thanks Bruno and Anthony
>
> I get it now.
>
> Does it "reference" work with Postgres?
>
> thanks
>
> Alex
>
>
> On Tuesday, January 1, 2013 6:32:53 PM UTC-8, Anthony wrote:
>>
>> db.define_table('PersonSkill',
>> Field('person_id','reference Person'),
>> Field('skill_id','reference Skill'),
>> Field('YearsOfExperience','integer'))
>>
>> web2py knows the primary key of the referenced table, so you don't have
>> to specify the name of that field. Specifying the table name is sufficient.
>>
>> Anthony
>>
>> On Tuesday, January 1, 2013 8:46:52 PM UTC-5, Alex Glaros wrote:
>>>
>>> can you please type out the syntax for me? mine below gets syntax
>>> errors. I added the *Person*.id and *Skill*.id so it would know which
>>> field in the table to reference
>>>
>>> db.define_table('PersonSkill',
>>> Field('person_id','reference Person.id'),
>>> Field('skill_id','reference Skill.id'),
>>> Field('YearsOfExperience','integer'))
>>>
>>> does the reference command work in Postgres?
>>>
>>> thanks,
>>>
>>> Alex
>>>
>>> On Tuesday, January 1, 2013 5:20:01 PM UTC-8, Anthony wrote:
>>>>
>>>> The name of a reference does not have to be the name of the field it is
>>>> referencing -- in fact, usually it is not the same name (in web2py, the
>>>> referenced field is typically "id"). In web2py, it is common for the
>>>> reference field to simply have the same name as the referenced table,
>>>> though some people like to tack "_id" onto the end of the field name. So,
>>>> in this case, field names "Person" and "Skill" would be typical, or maybe
>>>> "Person_id" and "Skill_id".
>>>>
>>>> Anthony
>>>>
>>>> On Tuesday, January 1, 2013 3:46:56 PM UTC-5, Alex Glaros wrote:
>>>>>
>>>>> what is the syntax for renaming a reference field in order to avoid
>>>>> duplicate names in a table?
>>>>>
>>>>> example:
>>>>>
>>>>> db.define_table('PersonSkill',
>>>>> Field('*id*','reference Person'),
>>>>> Field('*id*','reference Skill'),
>>>>> Field('YearsOfExperience','integer'))
>>>>>
>>>>> The "id" field name would be duplicate because it is the same spelling
>>>>> in Person Table and Skill Table.
>>>>>
>>>>> Also, does web2py reference field work in Postgres?
>>>>>
>>>>> thanks!
>>>>>
>>>>> Alex Glaros
>>>>>
>>>>
--