You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When inserting documents and knowing a certain document property value (e.g. house-id) is unique, is there a way to tell tinydb to use that house-id as document ID?
The document_id_class is a class variable, it's for all tinydb's Table (looks not ideal at first sight).
Would this approach make sense:
When inserting a new Mapping, first make it a Document(mapping, mapping.house-id) (where the doc_id equal to the house-id).
However Document needs an int type doc_it. Should one also subclass Document to customize the doc_id's type and change the Table's document_class?
When creating a Table sub-class, one also has to create TinyDB sub-class to modify its class variable table_class?
Is there a more elegant approach that I'm overlooking?
The text was updated successfully, but these errors were encountered:
When inserting documents and knowing a certain document property value (e.g. house-id) is unique, is there a way to tell tinydb to use that house-id as document ID?
Just found #351
The
document_id_class
is a class variable, it's for all tinydb'sTable
(looks not ideal at first sight).Would this approach make sense:
When inserting a new Mapping, first make it a
Document(mapping, mapping.house-id)
(where the doc_id equal to the house-id).However
Document
needs anint
typedoc_it
. Should one also subclassDocument
to customize thedoc_id
's type and change theTable
'sdocument_class
?When creating a
Table
sub-class, one also has to create TinyDB sub-class to modify its class variabletable_class
?Is there a more elegant approach that I'm overlooking?
The text was updated successfully, but these errors were encountered: