forked from docarray/docarray
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsqlite.py
More file actions
38 lines (24 loc) · 1.18 KB
/
sqlite.py
File metadata and controls
38 lines (24 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
from docarray.array.document import DocumentArray
from docarray.array.storage.sqlite import StorageMixins, SqliteConfig
__all__ = ['SqliteConfig', 'DocumentArraySqlite']
class DocumentArraySqlite(StorageMixins, DocumentArray):
"""
DocumentArray that stores Documents in a `SQLite database <https://www.sqlite.org/index.html>`_.
This stores Documents on disk instead of keeping them in memory, and offers the simplest way of persisting data with DocArray.
With this implementation, :meth:`match` and :meth:`find` perform exact (exhaustive) vector search.
Example usage:
.. code-block:: python
from docarray import DocumentArray
# with default config
da = DocumentArray(storage='sqlite')
# with customized config
da1 = DocumentArray(storage='sqlite', config={'connection': 'example.db'})
# connect to a previously created database
da = DocumentArray(
storage='sqlite', config={'connection': 'example.db', 'table_name': 'mine'}
)
.. seealso::
For further details, see our :ref:`user guide <sqlite>`.
"""
def __new__(cls, *args, **kwargs):
return super().__new__(cls)