-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 12 Nov 2008, at 13:32, Gaetan de Menten wrote: > It should be possible to do with a "mock" engine. I don't know the > details though as this is a not very well documented feature of SA. > > engine = sa.create_engine(testing.db.name + "://", strategy="mock") > metadata.bind = engine > > http://www.sqlalchemy.org/docs/04/sqlalchemy_engine_strategies.html#docstrings_sqlalchemy.engine.strategies_MockEngineStrategy This looks promising and seems to work for the example below (note the "executor" kwarg, it takes a function) in that it pprints the SQL but I've not got as far as trying it with create_all() > from sqlalchemy import * > from pprint import pprint > engine = create_engine("postgres://", executor=pprint, > strategy="mock") > engine.execute('SELECT * from mytable;') Cheers, Graham -----BEGIN PGP SIGNATURE----- iEYEARECAAYFAkkgWYQACgkQOsmLt1NhivwKZwCfd2lZxVoFAZbHe1Tgx8QeqsSY TUgAoO26FKCIu+/Gte5ZpILiK48AUMlziQCVAgUBSSBZhFnrWVZ7aXD1AQKolwP9 GVFMte9tj6d2/+QoBMO5svFbkssHQq00SuYYjzAEI9qNG8EiyUgfQVQ48lTY4a8m unGDoD7HYiZPdU7Knq4nJbpjHTVjmOwgeIAMeBVOR5L/KHieg/xFURVwxYGxbS6B mLx972fDxv7n2T6yKoztnyAPypx/EeAo7THvtFvuL3M= =Mesd -----END PGP SIGNATURE----- --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "SQLElixir" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlelixir?hl=en -~----------~----~----~----~------~----~------~--~---
