This is exactly what happen...

Let say I have a table like this one in Postgres :

# Postgres

CREATE TABLE address
(
  id serial NOT NULL,
  door_number character varying,
  street character varying,
  city_id integer,
  CONSTRAINT address_pkey PRIMARY KEY (id )
)
WITH (
  OIDS=FALSE
);
ALTER TABLE address
  OWNER TO richard;

# OLD Models
db.define_table('address',
                Field('door_number', 'string'),
                Field('street', 'string'),
                Field('city_id', 'reference city'),
                )


# NEW Models with rname
db.define_table('Address',
                       Field('Door_Number', 'string', rname='door_number'),
                       Field('Street', 'string', rname='street'),
                       Field('City', 'reference city', rname='city_id'),
                       rname='address'
                       )

Then, I can access value like that :

db(db.Address.Door_Number == '1000').select(db.Address.ALL)

DAL, only know the models names, ex.: Door_Number

You can't not use the backend rname to interract with the backend...

Richard






On Tue, Apr 15, 2014 at 10:52 AM, Richard Vézina <
ml.richard.vez...@gmail.com> wrote:

> I am not sure what rname does...
>
> Does it do, what it means, so it should contains the real name of the
> backend table name for instance or the reverse...
>
> I make a test with one of my model, adding rname to the model for the
> table name and one of the table field and try to make a query and look at
> it (._select()) and get the rname that I defined as a table name and field.
>
> Richard
>
>
> On Tue, Apr 15, 2014 at 10:42 AM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> Hello Johann,
>>
>> Do you get any advice?
>>
>> I am in the process to test the rname feature and I don't find much
>> information, it's seems highly experimental and undocumented...
>>
>>
>> Except maybe this :
>>
>> https://groups.google.com/d/msg/web2py/_q5qcARON4E/6JLCHM3eQHAJ
>>
>>
>> Richard
>>
>>
>> On Tue, Apr 1, 2014 at 4:41 AM, Johann Spies <johann.sp...@gmail.com>wrote:
>>
>>> Database: Postgresql
>>>
>>> I get this regularly when I modify a table's definition (tables using
>>> rname):
>>>
>>> ProgrammingError: relation "org_unit" does not exist
>>>
>>> I either set 'migrate = False'  or drop the table, delete the entry in
>>> databases and do it over - that is when the table is empty.
>>>
>>> I suspect it is a problem with rname.
>>>
>>> Here is an example definition (btw the fields with 'text' will be
>>> changed to 'citext' in Postgresql)
>>>
>>>
>>> db.define_table('org_unit',
>>>                 Field('name', 'text'),
>>>                 Field('city', 'text'),
>>>                 Field('post_code', length=14),
>>>                 Field('street', 'text'),
>>>                 Field('country', 'text'),
>>>                 Field('countrycode', length = 2),
>>>                 rname = '"level1"."org_unit"',
>>>                 migrate = True,
>>>                 fake_migrate = False)
>>>
>>> Regards
>>> Johann
>>> --
>>> Because experiencing your loyal love is better than life itself,
>>> my lips will praise you.  (Psalm 63:3)
>>>
>>> --
>>> 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.
>>>
>>
>>
>

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

Reply via email to