Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions pandasql/sqldf.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,18 @@ def conn(self):
def _init_connection(self, conn):
if self.engine.name == 'postgresql':
conn.execute('set search_path to pg_temp')
elif self.engine.name == 'sqlite':
conn.connection.connection.create_function("REGEXP", 2, regex)

def _set_text_factory(self, dbapi_con, connection_record):
dbapi_con.text_factory = str


def regex(expr, item):
reg = re.compile(expr)
return reg.match(item) is not None


def get_outer_frame_variables():
""" Get a dict of local and global variables of the first outer frame from another file. """
cur_filename = inspect.getframeinfo(inspect.currentframe()).filename
Expand Down