Thread: [SQLObject] The latest SVN checkout.
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Peter G. <pe...@fs...> - 2004-02-06 19:21:10
|
Hey there! Just started working on my logging patch and when I was ready to try it out I found out that there are differences from the latest SVN snapshot compared to the 0.5.1 release, differences that break old code. For instance, there is no SQLObject.new(). Any plans on updating the examples and/or adding some documentation/comments to give a hint on how to make new instances of SQLObjects? Also, I'd like to have some input on logging info. For the first try I just replaced the printDebug() calls with debug messages, except the for the unwarranted rollback which is a warning. (it raises an exception when rollback or commit is executed outside transactions) I might sum several queries, like automatic schema generation, to info output and I will most likely add debug information for transactions too. Anything else I should think about? /Peter G |
From: Ian B. <ia...@co...> - 2004-02-06 21:21:21
|
Peter Gebauer wrote: > Hey there! > > Just started working on my logging patch and when I was ready to try it out > I found out that there are differences from the latest SVN snapshot compared > to the 0.5.1 release, differences that break old code. > > For instance, there is no SQLObject.new(). Any plans on updating the > examples and/or adding some documentation/comments to give a hint on how to > make new instances of SQLObjects? The changes go with my general plans for 0.6. I just committed them last night, so I haven't had a chance to update examples or docs, though tests are up to date. Basically, the SQLObject package becomes sqlobject, and SQLObject.py becomes main.py. .new() becomes __init__() (i.e., class instantiation creates a row), and you use .get() to retrieve an already-existant row. > Also, I'd like to have some input on logging info. For the first try I just > replaced the printDebug() calls with debug messages, except the for the > unwarranted rollback which is a warning. (it raises an exception when > rollback or commit is executed outside transactions) > > I might sum several queries, like automatic schema generation, to info > output and I will most likely add debug information for transactions too. > Anything else I should think about? That sounds good to me. I don't know the overhead of sending a logging message when no one is paying attention, so I don't know if it's worth it to keep the connection debug attribute. There's a good chance it doesn't matter. The debug argument should stay, though, because that's an easy way to control output, and it could just configure the logger to print output to stdout. I believe the logging package also introduces the concept of a hierarchy of loggers. So there could be, say, a general sqlobject logger, and per-connection loggers. Or the connection logger could be a settable attribute. Or there could be a general logger, and a SQL logger that logged all communication to the database. I don't really have much experience to draw upon using that module. I agree that schema generation, and perhaps some other stuff, can be at an INFO level, since it's definitely more interesting than other queries. Ian |
From: Peter G. <pe...@fs...> - 2004-02-07 00:54:34
|
> Basically, the SQLObject package becomes sqlobject, and SQLObject.py > becomes main.py. .new() becomes __init__() (i.e., class instantiation > creates a row), and you use .get() to retrieve an already-existant row. Thank's for clearing that up. > That sounds good to me. I don't know the overhead of sending a logging > message when no one is paying attention, so I don't know if it's worth Me niether. Since it only logs through a level "filter" it should be one method call and one int equality test at the most even if there is nothing to actualy log. At any rate, even if you log every database event the bottleneck wouldn't be streaming a ~50 character string to a file or console, I think the actual communication with the database will remain the actual bottleneck. Especially if you are not communicating with a local database. > it to keep the connection debug attribute. There's a good chance it > doesn't matter. The debug argument should stay, though, because that's > an easy way to control output, and it could just configure the logger to > print output to stdout. > > I believe the logging package also introduces the concept of a hierarchy > of loggers. So there could be, say, a general sqlobject logger, and > per-connection loggers. Or the connection logger could be a settable > attribute. Or there could be a general logger, and a SQL logger that > logged all communication to the database. I don't really have much > experience to draw upon using that module. Right now I can follow every connection-related matter through the logs. Stuff like object instansiation is not included, I think that's a waste of log. The interresting thing is the database communication and that's being logged well enough. I haven't put a lot of time to it yet, so it wouldn't be a tremendous loss of work if you choose to discard it. The logger is passed as a named argument to the connection constructor at instansiation time. I'm rewriting the examples to work with a logger too, I could rewrite them to work with the new 0.6 SQLObject design while I'm at it. /Peter |