Python Examples of pymysql.escape_string
www.programcreek.com › 93836 › pymysqlYou may also want to check out all available functions/classes of the module pymysql , or try the search function . def get_data_clone_id(self, key, site) -> None or int: clone_id = None key = pymysql.escape_string(re.sub(r" [_\-. ]", "%", key)) sql = "SELECT ` {site}` FROM `info_list` WHERE `search_name` LIKE ' {key}'".format(site=site, key=key) try: # Get clone id info from database clone_id = int(self.exec(sql=sql) [0]) except TypeError: # The database doesn't have the search data, Return ...
AttributeError: 'module' object has no attribute 'escape ...
github.com › PyMySQL › PyMySQLNov 25, 2014 · from pymysql import install_as_MySQLdb install_as_MySQLdb() def mysqldb_escape(value, conv_dict): from pymysql.converters import encoders vtype = type(value) # note: you could provide a default: # PY2: encoder = encoders.get(vtype, escape_str) # PY3: encoder = encoders.get(vtype, escape_unicode) encoder = encoders.get(vtype) return encoder(value) import pymysql setattr(pymysql, 'escape', mysqldb_escape) del pymysql