@@ -87,18 +87,16 @@ def _parse(self, e):
8787 return str (e )
8888
8989 def execute (self , text , ** params ):
90- """
91- Execute a SQL statement.
92- """
90+ """Execute a SQL statement."""
91+
9392 class UserDefinedType (sqlalchemy .TypeDecorator ):
94- """
95- Add support for expandable values, a la https://bitbucket.org/zzzeek/sqlalchemy/issues/3953/expanding-parameter.
96- """
93+ """Add support for expandable values, a la https://bitbucket.org/zzzeek/sqlalchemy/issues/3953/expanding-parameter."""
9794
9895 impl = sqlalchemy .types .UserDefinedType
9996
10097 def process_literal_param (self , value , dialect ):
10198 """Receive a literal parameter value to be rendered inline within a statement."""
99+
102100 def process (value ):
103101 """Render a literal value, escaping as needed."""
104102
@@ -147,8 +145,7 @@ def process(value):
147145 else :
148146 return process (value )
149147
150- # Allow only one statement at a time
151- # SQLite does not support executing many statements
148+ # Allow only one statement at a time, since SQLite doesn't support multiple
152149 # https://docs.python.org/3/library/sqlite3.html#sqlite3.Cursor.execute
153150 if len (sqlparse .split (text )) > 1 :
154151 raise RuntimeError ("too many statements at once" )
@@ -234,10 +231,10 @@ def process(value):
234231def _connect (dbapi_connection , connection_record ):
235232 """Enables foreign key support."""
236233
237- # Ensure backend is sqlite
234+ # If back end is sqlite
238235 if type (dbapi_connection ) is sqlite3 .Connection :
239- cursor = dbapi_connection .cursor ()
240236
241237 # Respect foreign key constraints by default
238+ cursor = dbapi_connection .cursor ()
242239 cursor .execute ("PRAGMA foreign_keys=ON" )
243240 cursor .close ()
0 commit comments