Multi tenancy support on Document Objects #46
Replies: 5 comments 3 replies
-
@harshalizode apologies for the delay but this week has been very busy. We will need to see what you mean with care and come back to you |
Beta Was this translation helpful? Give feedback.
-
Hello I have implemented the logic partially can you check is I am implementing it in correct way. firstly I have added the from_collection attribute in the meta field as:
then I have overrided the from_row() method in the Document as:
Here, I have added the keyword argument from_collection and from here only we can set the collection object in the meta class of requested model. In QueryManager we can override the method:
Here, I have have passed the manager._collection to the from_collection while creating the document object. If any user change the database at the run time then we can store the collection instance to query on the same requested database, rather than taking the collection from the database. Using this approach we can first check the from_collection meta variable has the collection object or not, if yes then we will use this to further query otherwise we can continue with the cls.meta.collection._collection. after using the from_collection we can garbage it or we can override in every request. Is it right way? Without this we need to pass the collection object to do as such operation on the requested database. Developer need to pass the collection objects to query on particular database. |
Beta Was this translation helpful? Give feedback.
-
@tarsil any suggestions on it? or did something need to be improved? |
Beta Was this translation helpful? Give feedback.
-
@tarsil can we create the pull request for it? or any improvement requires? |
Beta Was this translation helpful? Give feedback.
-
@harshalizode apologies. For sure, open a pull request for it. Let me have a look. There is no specific direct API for this so it will be very interesting to see what you came out with. |
Beta Was this translation helpful? Give feedback.
-
Hello,
I'm working on implementing the feature for the document method to execute operations on many databases at once.
In current implementation we are retrieve the collection object from the model class meta, before querying into database using the document object methods.
To implement the feature, I am overriding the following methods:
Is there another strategy to implementing this functionality that we can take?
Beta Was this translation helpful? Give feedback.
All reactions