Skip to content

Instantly share code, notes, and snippets.

@fehrenbach
Created March 30, 2016 10:20
Show Gist options
  • Select an option

  • Save fehrenbach/d9632263738125bed93ea5f659695e19 to your computer and use it in GitHub Desktop.

Select an option

Save fehrenbach/d9632263738125bed93ea5f659695e19 to your computer and use it in GitHub Desktop.
var db = database "links";
var agencies =
table "agencies"
with (oid: Int,
id: Int,
name: String,
based_in: String,
phone: String)
where oid readonly
tablekeys [["oid"], ["id"]]
from db;
var externalTours =
table "externaltours"
with (oid: Int,
id: Int,
name: String,
destination: String,
type: String,
price: Int)
where oid readonly
tablekeys [["oid"], ["id"]]
from db;
lineage {
for (a <-- agencies)
for (e <-- externalTours)
where (a.name == e.name && e.type == "boat")
[(name = a.name,
phone = a.phone)]
}
# [(data = (name = "BayTours", phone = "415-1200"),
# prov = [(row = 30766, "table" = "agencies"), (row = 30770, "table" = "externaltours")]),
# (data = (name = "BayTours", phone = "415-1200"),
# prov = [(row = 30766, "table" = "agencies"), (row = 30771, "table" = "externaltours")]),
# (data = (name = "HarborCruz", phone = "831-3000"),
# prov = [(row = 30767, "table" = "agencies"), (row = 30772, "table" = "externaltours")])] : [(data:(name:String,phone:String),prov:[(row:Int,table:String)])]
# query {
# for (y_a_g126 <- agencies.2())
# for (z_a_g127 <- query {
# for (y_e_g124 <- externalTours.2())
# for (z_e_g125 <- [(data = (name = y_a_g126.data.name,
# phone = y_a_g126.data.phone),
# prov = [])])
# where (y_a_g126.data.name == y_e_g124.data.name &&
# y_e_g124.data.type == "boat")
# [(data = z_e_g125.data,
# prov = y_e_g124.prov ++ z_e_g125.prov)]
# })
# [(data = z_a_g127.data, prov = y_a_g126.prov ++ z_a_g127.prov)]
# }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment