How about this?
number_of_dog_colors = db(db.dog.id>0).count(distinct=True)
On 4/19/2012 8:57 PM, Cody Goodman wrote:
I have multiple databases:
dog
-------
type
color
sound
car
------
model
maker
condition
I need to generate a grid with the table names, then under them the
number of columns there are. I have made multiple DAL objects for each
database like so:
dog = DAL('mysql://root:@localhost/dog)
car = DAL('mysql://root:@localhost/car)
I then thought I could just make select statements getting the count
of each column like this:
number_of_dog_colors = len(db().select(dog.type.color))
Of course my syntax for that is wrong and I got a :
<type 'exceptions.AttributeError'> 'function' object has no
attribute 'color'
I was just wondering what the correct syntax to do that was, and if
I'm going about it correctly. Once I get the syntax correct, I was
going to make a list of all the table names, then get the count for
each. If anyone knows a better way to do this, please let me know.
Thanks in advance for any help.
Sincerely,
Cody Goodman
No virus found in this message.
Checked by AVG - www.avg.com <http://www.avg.com>
Version: 2012.0.1913 / Virus Database: 2411/4947 - Release Date: 04/19/12
--
Jim Steil
VP of Information Technology
Quality Liquid Feeds, Inc.
608.935.2345 office
608.341.9896 cell