]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- restored engine.echo flag
authorMike Bayer <mike_mp@zzzcomputing.com>
Wed, 22 Aug 2007 16:58:26 +0000 (16:58 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Wed, 22 Aug 2007 16:58:26 +0000 (16:58 +0000)
- changelog

CHANGES
lib/sqlalchemy/engine/base.py
lib/sqlalchemy/logging.py

diff --git a/CHANGES b/CHANGES
index 9974f08cf3f57a11c8507b9ec72b4b983ce83966..732499d9098c6591dc26f8b11f03aba5ee7c5455 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -22,6 +22,10 @@ CHANGES
 - Fix to bind param processing such that "False" values (like blank strings)
   still get processed/encoded.
 
+- Fix to select() "generative" behavior, such that calling column(),
+  select_from(), correlate(), and with_prefix() does not modify the
+  original select object [ticket:752]
+  
 - Added a "legacy" adapter to types, such that user-defined TypeEngine
   and TypeDecorator classes which define convert_bind_param() and/or
   convert_result_value() will continue to function.  Also supports
index d3d96a711a41f8c505ef8f5310d76adb79941705..c13c1d9468383c16407e4d3cfd17b7225a4d2660 100644 (file)
@@ -1010,6 +1010,7 @@ class Engine(Connectable):
         self.logger = logging.instance_logger(self, echoflag=echo)
 
     name = property(lambda s:sys.modules[s.dialect.__module__].descriptor()['name'], doc="String name of the [sqlalchemy.engine#Dialect] in use by this ``Engine``.")
+    echo = logging.echo_property()
     
     def __repr__(self):
         return 'Engine(%s)' % str(self.url)
index 2dfd1e50adabd933f75e7258170afaf5c7bf66c1..2ced66109e0f4aa4b640b497ceb01b40d7beb8d3 100644 (file)
@@ -75,4 +75,23 @@ def instance_logger(instance, echoflag=None):
     instance._should_log_debug = l.isEnabledFor(logging.DEBUG)
     instance._should_log_info = l.isEnabledFor(logging.INFO)
     return l
+
+class echo_property(object):
+    __doc__ = """when ``True``, enable log output for this element.
+
+    This has the effect of setting the Python logging level for the
+    namespace of this element's class and object reference.  A value
+    of boolean ``True`` indicates that the loglevel ``logging.INFO`` will be
+    set for the logger, whereas the string value ``debug`` will set the loglevel
+    to ``logging.DEBUG``.
+    """
+
+    def __get__(self, instance, owner):
+        if instance is None:
+            return self
+        else:
+            return instance._should_log_debug and 'debug' or (instance._should_log_info and True or False)
+
+    def __set__(self, instance, value):
+        instance_logger(instance, echoflag=value)
     
\ No newline at end of file