I'm not sure exactly what you mean here. You can write a function that
iterates over the rows and selects the attributes that you want.

Simon,

Let me try to be more clear.

There's a database table named 'organizations', and an SA model class
associated with it. One of the columns in the organization class, industry,
is defined as:

industry = Column(String, default='Other',
                  ForeignKey('industries.ind_name', onupdate="CASCADE", 
ondelete="RESTRICT"))

The industry classe is defined prior to the organization class:

class Industries(Base):
    __tablename__ = 'industries'

    ind_name = Column(String, primary_key=True)

When I query the database table using psql,
        select * from industries order by ind_name;
psql displays this:

ind_name -----------------
 Attorney
 Business
 Consultant
 Energy
 Farming
 Forest products
 Government
 Livestock
 Manufacturing
 Maritime
 Mining
 Other
(12 rows)

My assumption is that SA will return the same results. I want to present
these names in the tkinter form for the organizations class within a
ttk.Combobox by dropping the first two, and last, rows and making a list of
the ind_name strings. There is another column in this class (and one in
another class) where acceptable values for those variables are also in
lookup tables.

What is the most efficient way to do this? I thought that a function which
ignores the first two rows then addes all but the last to a list would do
the job so confirmation is helpful.

If I'm still not explaining well enough I'll try again. :-)

Regards,

Rich

--
SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- You received this message because you are subscribed to the Google Groups "sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to