Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #794 (closed defect: fixed)

Opened 13 years ago

Last modified 12 years ago

sqlalchemy echo is broken or has changed ( 0.9a4 using PackageEngine

Reported by: jvanasco@… Owned by: anonymous
Priority: normal Milestone: 1.0
Component: Documentation Version: 0.9a4
Severity: normal Keywords:
Cc:

Description

The wiki shows tg to support echo in sqlalchemy as such:

http://trac.turbogears.org/turbogears/wiki/UsingSqlAlchemy

That no longer works , perhaps becise of the new PackageEngine? method --- [dev.cfg] sqlalchemy.dburi="postgres://database=xxxx&host=localhost&user=xxx" sqlalchemy.echo = 1

[model.py] import turbogears engine = engine = turbogears.database.PackageEngine?("findmeon") engine.echo = True ---

i think the issue is because echo isn't carried over into the engine instantiation.

I did a bunch of tracing / debugging / exploring and found that this will turn echo on (at least in 'tg-admin shell' ) AFTER another sql query has been made

engine._engine.echo = True

engine._engine is a None type on startup - its not a 'sqlalchemy.databases.postgres.PGSQLEngine object' until a query is made

onece a query is made, it is instantiated, but there is no .echo set based on the config defaults

at that point, using tg-admin shell, one can set 'engine._engine.echo = True' , and echo will work. setting it before a query is made ( which instantiates a connection ), will just raise an exception on a None Type.

I posted something on the group, but no one commented , so i'm ticketing it  http://groups.google.com/group/turbogears/browse_frm/thread/10dc9a5bae2929ee

I'm not sure if this is an error on documentation or just if support has broken

Change History

comment:1 Changed 13 years ago by godoy

  • Component changed from TurboGears to Docs
  • Milestone set to 1.0

From SQL Alchemy's docs it looks like echo can just be set at an instance of engine -- as you've found out -- or at the engine creation, as in:

from sqlalchemy import *
db = create_engine('sqlite://filename=mydb', echo=True)

So, I'm changing the component to Docs, to have it fixed accordingly to SQL Alchemy's documentation.

comment:2 Changed 13 years ago by jorge.vargas

  • Status changed from new to closed
  • Resolution set to fixed

this is no longer on the docs

 http://docs.turbogears.org/1.0/SQLAlchemy

if you want to add it please do so :)

Note: See TracTickets for help on using tickets.