def do_executemany(self, cursor, statement, parameters, context=None): try: stmt = context.compiled._panda_fn except AttributeError: raise exc.StatementError( "Only Pandas-compiled statements can be " "executed by this dialect", statement, parameters, None) cursor.executemany(stmt, parameters)
def sqlite_regex_match(element, compiler, **kw): """Compile the SQL expression representing a regular expression match for the SQLite engine. """ # determine the name of a custom SQLite function to use for the operator operator = element.operator.opstring try: func_name, _ = SQLITE_REGEX_FUNCTIONS[operator] except (KeyError, ValueError), e: would_be_sql_string = ' '.join( (compiler.process(element.left), operator, compiler.process(element.right))) raise exc.StatementError( "unknown regular expression match operator: %s" % operator, would_be_sql_string, None, e)
def sqlite_regex_match(element, compiler, **kw): """Compile the SQL expression representing a regular expression match for the SQLite engine.""" # determine the name of a custom SQLite function to use for the operator operator = element.operator.opstring try: func_name, _ = SQLITE_REGEX_FUNCTIONS[operator] except (KeyError, ValueError) as e: would_be_sql_string = ' '.join( (compiler.process(element.left), operator, compiler.process(element.right))) raise exc.StatementError( f"unknown regular expression match operator: {operator} {would_be_sql_string} {e}" ) # compile the expression as an invocation of the custom function regex_func = getattr(func, func_name) regex_func_call = regex_func(element.left, element.right) return compiler.process(regex_func_call)
def sqlite_regex_match(element, compiler, **kw): operator = element.operator.opstring try: func_name, _ = SQLITE_REGEX_FUNCTIONS[operator] except (KeyError, ValueError) as e: would_be_sql_string = ' '.join(( compiler.process(element.left), operator, compiler.process(element.right) )) raise exc.StatementError( 'unknown regexp match operator: {}'.format(operator), would_be_sql_string, None, e ) regex_fn = getattr(func, func_name) regex_fn_call = regex_fn(element.left, element.right) return compiler.process(regex_fn_call)