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
{{ message }}
This repository has been archived by the owner on Aug 27, 2023. It is now read-only.
Hi steven! Has there been any progress in this area? I've been using this library for a while now, and am pretty happy with it. Thanks for taking the time to write it!
To get the conversation started, how about we consider something like this:
class RefType(TypeDefinition):
type = dict
aliases = ['ref'] # alternate names that reference this type
ddb_data_type = MAP
def coerce(self, value, force):
# How do we type check a model? issubclass(value, Model)?
return value
def ddb_dump(self, value):
# Somehow get the parent model's key
return self.model.meta_.pk_dict(results[-1], ddb_dump=True)
def ddb_load(self, value):
return engine.get(self.model, **value)
We probably want to do something with Field... perhaps derive a RefField? in order to hide a lot of this.
Anyway, this is just off the top of my head ATM. I know I'm already running into this in my own project, and I have to run through a chain of queries (saving off only the hash_key). Would be nice to use some of the optimizations like batched queries, etc...
I have the start of a Reference field located here. @stevearc I could really use your help with the caching. I have unittests that shows what I'm having trouble with. Any help would be most appreciated!
@stevearc or anyone else that is interested... I now have a working Reference field that correctly loads, saves and deletes (including cascading deletes) located here. It would be really nice if I could get some peer review, and perhaps move it into the core library, but for now it should work as stand alone package.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Some way to have models reference models. One-to-one, one-to-many, and many-to-many should be supported.
Since we don't have the benefit of a SQL database, we'll have to consider the following:
The text was updated successfully, but these errors were encountered: