> class T2(Base):
>     __table__ = Table("t2", Base.metadata, autoload_with=session.connection())
>     __mapper_args__ = {
>         "primary_key": [__table__.c.source_file]  # a primary key must
> be determined
>     }

I find this software design approach also interesting.

I have tried the following code variant out.

…
   my_inspector = Inspector.from_engine(engine)
   results = Table('t2', MetaData())
   my_inspector.reflecttable(results, None)
   entries = session.query(func.count("*")).select_from(results).scalar()

   if entries > 0:
      delimiter = "|"
      sys.stdout.write(delimiter.join( ("statement1",
                                        "statement2",
                                        '"function name"',
                                        '"source file"',
                                        "incidence") ))
      sys.stdout.write("\r\n")
      for statement1, statement2, name, source_file, incidence \
          in session.query(results.statement1,
                           results.statement2,
                           results.name,
                           results.source_file,
                           results.C).order_by(results.source_file,
                                               results.name,
                                               results.statement1,
                                               results.statement2):
         sys.stdout.write(delimiter.join( (statement1,
                                           statement2,
                                           name,
                                           source_file,
                                           str(incidence)) ))
         sys.stdout.write("\r\n")
   else:
…


Unfortunately, I stumble on another error message after a text line
is displayed in the expected way.

AttributeError: 'Table' object has no attribute 'statement1'


Which adjustments would be needed here?

Regards,
Markus

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