- @staticmethod
- def table_columns(path, table):
- return ['c1', 'c2', 'c3']
-
- @staticmethod
- def get_all_foreign_keys(path):
- return {
- 'table1': {'incoming': [], 'outgoing': []},
- 'table2': {'incoming': [], 'outgoing': []},
- }
-
- @staticmethod
- def table_counts(path, *args, **kwargs):
- return {
- 'table1': 2,
- 'table2': 2,
- }
-
-
-def inspect(path):
- tables = {}
- views = []
-
- for table in ['table1', 'table2']:
- tables[table] = {
- 'name': table,
- 'columns': ['c1', 'c2', 'c3'],
- 'primary_keys': [],
- 'count': 2,
- 'label_column': None,
- 'hidden': False,
- 'fts_table': None,
- 'foreign_keys': {'incoming': [], 'outgoing': []},
- }
-
- return tables, views, _connector_type
-
-
-class Connection:
- def __init__(self, path):
- self.path = path
-
- def execute(self, sql, params=None, truncate=False, page_size=None, max_returned_rows=None):
- sql = sql.strip()
-
- rows = []
+ def hidden_table_names(self):
+ return []
+
+ def detect_spatialite(self):
+ return False
+
+ def view_names(self):
+ return []
+
+ def table_count(self, table_name):
+ return 2
+
+ def table_info(self, table_name):
+ return [
+ {
+ 'cid': 0,
+ 'name': 'c1',
+ 'type': 'integer',
+ 'notnull': False,
+ 'default_value': None,
+ 'is_pk': False,
+ },
+ {
+ 'cid': 1,
+ 'name': 'c2',
+ 'type': 'integer',
+ 'notnull': False,
+ 'default_value': None,
+ 'is_pk': False,
+ },
+ {
+ 'cid': 2,
+ 'name': 'c3',
+ 'type': 'integer',
+ 'notnull': False,
+ 'default_value': None,
+ 'is_pk': False,
+ },
+ ]
+
+ def detect_fts(self, table_name):
+ return False
+
+ def foreign_keys(self, table_name):
+ return []
+
+ def table_exists(self, table_name):
+ return table_name in ['table1', 'table2']
+
+ def table_definition(self, table_type, table_name):
+ return 'CREATE TABLE ' + table_name + ' (c1, c2, c3)'
+
+ def indices_definition(self, table_name):
+ return []
+
+ def execute(
+ self,
+ sql,
+ params=None,
+ truncate=False,
+ custom_time_limit=None,
+ page_size=None,
+ log_sql_errors=True,
+ ):
+ results = []