62def init(engine_settings):
63 global _connection # pylint: disable=global-statement
65 if 'query_str' not in engine_settings:
66 raise ValueError('query_str cannot be empty')
68 if not engine_settings['query_str'].lower().startswith('select '):
69 raise ValueError('only SELECT query is supported')
71 _connection = mysql.connector.connect(
77 auth_plugin=auth_plugin,
81def search(query, params):
82 query_params = {'query': query}
83 query_to_run = query_str + ' LIMIT {0} OFFSET {1}'.format(limit, (params['pageno'] - 1) * limit)
85 with _connection.cursor() as cur:
86 cur.execute(query_to_run, query_params)
88 return _fetch_results(cur)