[web2py] Table names: plural or singular?

2010-11-30 Thread pbreit
Sorry for the newbie, religious question but what is the preference in
web2py for table names, plural or singular? Most of the docs seem to
indicate singular since that seems to make more sense in code (and you
don't really use SQL all that much). But I did see some examples with
plural.


Re: [web2py] Table names: plural or singular?

2010-11-30 Thread Branko Vukelic
On Tue, Nov 30, 2010 at 10:48 PM, pbreit pbreitenb...@gmail.com wrote:
 Sorry for the newbie, religious question but what is the preference in
 web2py for table names, plural or singular? Most of the docs seem to
 indicate singular since that seems to make more sense in code (and you
 don't really use SQL all that much). But I did see some examples with
 plural.

+1 for plural, just to make the discussion more interesting. :)

Anyway, the reason for plurals is: it's a table, so it contains many
records for something.
Reason for singular is: ... it looks better in the API.

singular in an API example:

get.people.last() vs Get last person
get.person.last() vs Get last person (more similar?)

-- 
Branko Vukelić

bg.bra...@gmail.com
stu...@brankovukelic.com

Check out my blog: http://www.brankovukelic.com/
Check out my portfolio: http://www.flickr.com/photos/foxbunny/
Registered Linux user #438078 (http://counter.li.org/)
I hang out on identi.ca: http://identi.ca/foxbunny

Gimp Brushmakers Guild
http://bit.ly/gbg-group


Re: [web2py] Table names: plural or singular?

2010-11-30 Thread Thadeus Burgess
I prefer singular for the Object models and plural for the tablenames.

class Person:
  __tablename__ = 'people'

Since the table contains many of the records, but an object instance will
only contain one of those rows.

--
Thadeus




On Tue, Nov 30, 2010 at 5:13 PM, Branko Vukelic bg.bra...@gmail.com wrote:

 On Tue, Nov 30, 2010 at 10:48 PM, pbreit pbreitenb...@gmail.com wrote:
  Sorry for the newbie, religious question but what is the preference in
  web2py for table names, plural or singular? Most of the docs seem to
  indicate singular since that seems to make more sense in code (and you
  don't really use SQL all that much). But I did see some examples with
  plural.

 +1 for plural, just to make the discussion more interesting. :)

 Anyway, the reason for plurals is: it's a table, so it contains many
 records for something.
 Reason for singular is: ... it looks better in the API.

 singular in an API example:

 get.people.last() vs Get last person
 get.person.last() vs Get last person (more similar?)

 --
 Branko Vukelić

 bg.bra...@gmail.com
 stu...@brankovukelic.com

 Check out my blog: http://www.brankovukelic.com/
 Check out my portfolio: http://www.flickr.com/photos/foxbunny/
 Registered Linux user #438078 (http://counter.li.org/)
 I hang out on identi.ca: http://identi.ca/foxbunny

 Gimp Brushmakers Guild
 http://bit.ly/gbg-group



Re: [web2py] Table names: plural or singular?

2010-11-30 Thread Branko Vukelic
Yeah, this is the pattern I usually use, too.

On Wed, Dec 1, 2010 at 12:41 AM, Thadeus Burgess thade...@thadeusb.com wrote:
 I prefer singular for the Object models and plural for the tablenames.

 class Person:
   __tablename__ = 'people'

 Since the table contains many of the records, but an object instance will
 only contain one of those rows.

 --
 Thadeus




 On Tue, Nov 30, 2010 at 5:13 PM, Branko Vukelic bg.bra...@gmail.com wrote:

 On Tue, Nov 30, 2010 at 10:48 PM, pbreit pbreitenb...@gmail.com wrote:
  Sorry for the newbie, religious question but what is the preference in
  web2py for table names, plural or singular? Most of the docs seem to
  indicate singular since that seems to make more sense in code (and you
  don't really use SQL all that much). But I did see some examples with
  plural.

 +1 for plural, just to make the discussion more interesting. :)

 Anyway, the reason for plurals is: it's a table, so it contains many
 records for something.
 Reason for singular is: ... it looks better in the API.

 singular in an API example:

 get.people.last() vs Get last person
 get.person.last() vs Get last person (more similar?)

 --
 Branko Vukelić

 bg.bra...@gmail.com
 stu...@brankovukelic.com

 Check out my blog: http://www.brankovukelic.com/
 Check out my portfolio: http://www.flickr.com/photos/foxbunny/
 Registered Linux user #438078 (http://counter.li.org/)
 I hang out on identi.ca: http://identi.ca/foxbunny

 Gimp Brushmakers Guild
 http://bit.ly/gbg-group





-- 
Branko Vukelić

bg.bra...@gmail.com
stu...@brankovukelic.com

Check out my blog: http://www.brankovukelic.com/
Check out my portfolio: http://www.flickr.com/photos/foxbunny/
Registered Linux user #438078 (http://counter.li.org/)
I hang out on identi.ca: http://identi.ca/foxbunny

Gimp Brushmakers Guild
http://bit.ly/gbg-group


Re: [web2py] Table names: plural or singular?

2010-11-30 Thread Jason Brower
I use sigular, cause my teacher burned in into our heads if we thought
different. :D
BR,
Jason Brower

On Wed, 2010-12-01 at 01:31 +0100, Branko Vukelic wrote:

 Yeah, this is the pattern I usually use, too.
 
 On Wed, Dec 1, 2010 at 12:41 AM, Thadeus Burgess thade...@thadeusb.com 
 wrote:
  I prefer singular for the Object models and plural for the tablenames.
 
  class Person:
__tablename__ = 'people'
 
  Since the table contains many of the records, but an object instance will
  only contain one of those rows.
 
  --
  Thadeus
 
 
 
 
  On Tue, Nov 30, 2010 at 5:13 PM, Branko Vukelic bg.bra...@gmail.com wrote:
 
  On Tue, Nov 30, 2010 at 10:48 PM, pbreit pbreitenb...@gmail.com wrote:
   Sorry for the newbie, religious question but what is the preference in
   web2py for table names, plural or singular? Most of the docs seem to
   indicate singular since that seems to make more sense in code (and you
   don't really use SQL all that much). But I did see some examples with
   plural.
 
  +1 for plural, just to make the discussion more interesting. :)
 
  Anyway, the reason for plurals is: it's a table, so it contains many
  records for something.
  Reason for singular is: ... it looks better in the API.
 
  singular in an API example:
 
  get.people.last() vs Get last person
  get.person.last() vs Get last person (more similar?)
 
  --
  Branko Vukelić
 
  bg.bra...@gmail.com
  stu...@brankovukelic.com
 
  Check out my blog: http://www.brankovukelic.com/
  Check out my portfolio: http://www.flickr.com/photos/foxbunny/
  Registered Linux user #438078 (http://counter.li.org/)
  I hang out on identi.ca: http://identi.ca/foxbunny
 
  Gimp Brushmakers Guild
  http://bit.ly/gbg-group
 
 
 
 
 


attachment: face-smile-big.png