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
Replace handwritten migrators with type-safe composable workflow syntax.
Current Workaround
Currently, we need to manually manage potentially batching/pooling and lots of string interpolation for mutations.
Proposed Solution
Write a command extension for OpenWDL - Spec 1.0 or adopt a similar sort of syntax
Given a schema.tql:
define
name sub attribute,
value string;
location sub entity,
abstract,
owns name @key,
plays location-hierarchy:superior,
plays location-hierarchy:subordinate;
area sub location;
city sub location;
country sub location;
location-hierarchy sub relation,
relates superior,
relates subordinate;
We create a workflow description:
import"schema.tql.wdl" # Codegen the AST traversal to spit out the typed struct mapping.structLocationBatch{
Array[Location] locationsArray[Area] areasArray[City] citiesArray[Country] countriesArray[LocationHierarchy] location_hierarchies
}
taskcast_entity_relations{
input {LocationBatchbatch
}
command <<<
typedb_loader <<CODE for {name, lat, long} <- %locations% { insert$location isa location, has? %name%, has %lat%, has %long; } >>> output { TypeDBBatch[Location] = read_batch_result(stdout()) } meta { concurrency: 32, batch_size: 1000, }
This would be a currently valid program description (given a typedb_loader extension). This could also be improved with better syntax surrounding the projection of source -> subgraph for insertion.
Additional Information
The current loader approach certainly works, but it's anything but readable/convenient. This type of solution has the added benefit of compossibility, so you can have a task for csv->subgraph and a task for subgraph->batch_upsert, etc...
The text was updated successfully, but these errors were encountered:
Problem to Solve
Replace handwritten migrators with type-safe composable workflow syntax.
Current Workaround
Currently, we need to manually manage potentially batching/pooling and lots of string interpolation for mutations.
Proposed Solution
Write a command extension for OpenWDL - Spec 1.0 or adopt a similar sort of syntax
Given a
schema.tql
:We create a workflow description:
This would be a currently valid program description (given a
typedb_loader
extension). This could also be improved with better syntax surrounding the projection ofsource
->subgraph
for insertion.Additional Information
The current loader approach certainly works, but it's anything but readable/convenient. This type of solution has the added benefit of compossibility, so you can have a task for
csv->subgraph
and a task forsubgraph->batch_upsert
, etc...The text was updated successfully, but these errors were encountered: