This is the first time I use SQLAlchemy so sorry if the following is not
clear:
I have a table as follow:
class Person(Base):
__tablename__ = 'person'
# Here we define columns for the table 'person'
# Notice that each column is also a normal Python instance attribute
id = Column(Integer, primary_key=True)
name = Column (String(250), nullable=False)
How can I iterate through all the column names in the table object ?
basiccally I would like to iterate through all Person attributes and print
the column name.
The following did not seem to work
>>> for column_name in person:
... print column_name
...
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'Person' object is not iterable
>>>
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.