88import sys
99import warnings
1010
11+
1112class SQL (object ):
1213 """Wrap SQLAlchemy to provide a simple SQL API."""
1314
@@ -23,7 +24,7 @@ def __init__(self, url, **kwargs):
2324
2425 # log statements to standard error
2526 logging .basicConfig (level = logging .DEBUG )
26- self .logger = logging .getLogger (__name__ )
27+ self .logger = logging .getLogger ("cs50" )
2728
2829 # create engine, raising exception if back end's module not installed
2930 self .engine = sqlalchemy .create_engine (url , ** kwargs )
@@ -36,7 +37,9 @@ class UserDefinedType(sqlalchemy.TypeDecorator):
3637 """
3738 Add support for expandable values, a la https://bitbucket.org/zzzeek/sqlalchemy/issues/3953/expanding-parameter.
3839 """
40+
3941 impl = sqlalchemy .types .UserDefinedType
42+
4043 def process_literal_param (self , value , dialect ):
4144 """Receive a literal parameter value to be rendered inline within a statement."""
4245 def process (value ):
@@ -109,7 +112,8 @@ def process(value):
109112
110113 # bind parameters before statement reaches database, so that bound parameters appear in exceptions
111114 # http://docs.sqlalchemy.org/en/latest/core/sqlelement.html#sqlalchemy.sql.expression.text
112- statement = statement .bindparams (sqlalchemy .bindparam (key , value = value , type_ = UserDefinedType ()))
115+ statement = statement .bindparams (sqlalchemy .bindparam (
116+ key , value = value , type_ = UserDefinedType ()))
113117
114118 # stringify bound parameters
115119 # http://docs.sqlalchemy.org/en/latest/faq/sqlexpressions.html#how-do-i-render-sql-expressions-as-strings-possibly-with-bound-parameters-inlined
0 commit comments