Add pydantic and initial sgqlc typesystems#75
Conversation
There was a problem hiding this comment.
Still working through, but I am a bit hesitant about Struct.abstract and particularly Struct.interfaces (but makes sense why you added). Maybe instead of storing that metadata on the Struct, we add extra arguments to the sgqlc TypeSystem/TypeAdapter to_system methods (defaulting to "type" rather than "interface")? That way, users could still convert pydantic -> arti, but then on conversion to sgqlc, choose to make it an Interface or Type (that should be good enough for our backend needs, where we can know when/what we want)?
That would mean roundtripping Interfaces wouldn't work by default, but I think that's probably ok (and likely unavoidable in some cases... unless we add some extra "metadata" field to each Type. I think parquet allows this, which pandas uses to track things like "Categorical", etc)
fcd21a8 to
0ec4a12
Compare
Codecov Report
@@ Coverage Diff @@
## golden #75 +/- ##
==========================================
Coverage 100.00% 100.00%
==========================================
Files 21 23 +2
Lines 927 1088 +161
Branches 117 136 +19
==========================================
+ Hits 927 1088 +161
Continue to review full report at Codecov.
|
0ec4a12 to
92ff710
Compare
92ff710 to
cb0d2ff
Compare
fb24a38 to
f3024b6
Compare
f3024b6 to
ff101e3
Compare
Co-authored-by: Jacob Hayes <[email protected]>
ff101e3 to
c7caf9b
Compare
|
@joycex99 I went a little overboard on the pydantic type converter, but Gonna go ahead and merge, but happy to have eyes on the second commit when/if you get a chance (some of the hook/hint stuff is a bit odd)! |
Adds TypeSystems for pydantic and sgqlc. A few known issues/TODOs:
issubclasscheck in pydantic <-> arti type doesn't always work, e.g.Timestamp.precisionis not a classinterfacesonStructin order to capture arbitrary interface(s) on sgqlc TypesI'm OOO until Aug 2 or 3, so wanted to put this up before I go.