1 from .connection import Connection
10 for entry_point in pkg_resources.iter_entry_points('datasette.connectors'):
11 db_connectors[entry_point.name] = entry_point.load()
14 def add_connector(name, connector):
15 db_connectors[name] = connector
17 class DatabaseNotSupported(Exception):
22 for connector in db_connectors.values():
24 return connector.connect(path)
28 raise ConnectorList.DatabaseNotSupported
33 connection_class = Connection
35 def connect(self, path):
36 return self.connection_class(path, self)
38 def table_names(self):
40 Return a list of table names
42 raise NotImplementedError
44 def hidden_table_names(self):
45 raise NotImplementedError
47 def detect_spatialite(self):
49 Return boolean indicating if geometry_columns exists
51 raise NotImplementedError
55 Return a list of view names
57 raise NotImplementedError
59 def table_count(self, table_name):
61 Return an integer with the rows count of the table
63 raise NotImplementedError
65 def table_info(self, table_name):
67 Return a list of dictionaries with columns description, with format:
77 raise NotImplementedError
79 def detect_fts(self, table_name):
81 Return boolean indicating if table has a corresponding FTS virtual table
83 raise NotImplementedError
85 def foreign_keys(self, table_name):
87 Return a list of dictionaries with foreign keys description
88 id, seq, table_name, from_, to_, on_update, on_delete, match
90 raise NotImplementedError
92 def table_exists(self, table_name):
94 Return boolean indicating if table exists in the database
96 raise NotImplementedError
98 def table_definition(self, table_type, table_name):
100 Return string with a 'CREATE TABLE' sql definition
102 raise NotImplementedError
104 def indices_definition(self, table_name):
106 Return a list of strings with 'CREATE INDEX' sql definitions
108 raise NotImplementedError
115 custom_time_limit=None,
119 raise NotImplementedError