SQLite#
You can use SQLite as a document store for DocumentArray. It’s suitable for accessing a large number of Documents which can’t fit in memory.
Usage#
from docarray import DocumentArray
da = DocumentArray(storage='sqlite') # with default config
da1 = DocumentArray(
storage='sqlite', config={'connection': 'example.db'}
) # with customize config
To reconnect a formerly persisted database, you can need to specify both connection
and table_name
in config
:
from docarray import DocumentArray
da = DocumentArray(
storage='sqlite', config={'connection': 'example.db', 'table_name': 'mine'}
)
da.summary()
Other functions behave the same as in-memory DocumentArray.
Config#
The following configs can be set:
Name |
Description |
Default |
---|---|---|
|
SQLite database filename |
a random temp file |
|
SQLite table name |
a random name |
|
None |
|
|
None |
|
|
|
|
|
|
|
|
Controls if ordering of Documents is persisted in the Database. Disabling this breaks list-like features, but can improve performance. |
True |
|
Boolean flag indicating whether to store |
True |