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
DEFINE TABLE writers SCHEMAFULL;
DEFINE FIELD firstname ON TABLE writers TYPE string;
DEFINE FIELD lastname ON TABLE writers TYPE string;
DEFINE FIELD birthdate ON TABLE writers TYPE datetime;
DEFINE TABLE books SCHEMAFULL;
DEFINE FIELD title ON TABLE books TYPE string;
DEFINE FIELD pages ON TABLE books TYPE optional<number>;
DEFINE FIELD description ON TABLE books TYPE string;
DEFINE FIELD weight ON TABLE books TYPE number;
DEFINE FIELD writer ON TABLE books TYPE record<writers>;
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hey there community !
I've developed a small python module to generate SURQL SDL strings.
The module is based on pydantic and is very simple to use.
✅ it supports the following features
and the following types out of the box :
❌ what it doesn't support yet :
PRs are welcome 😉
installation
To install pydantic-surql run :
or with poetry :
basic usage
to convert a pydantic model to a surql SDL definition you can use a simple decorator :
All the models decorated with
@surql_collection
will be collected by theMetadata
object, which will be used to generate the SDL.To generate the SDL :
this will generate the following SDL :
You can check more on :
Beta Was this translation helpful? Give feedback.
All reactions