insert as of

This commit is contained in:
jackfoxy 2023-12-15 14:02:55 -08:00
parent a0ed2df7ed
commit 097076f693
3 changed files with 470 additions and 51 deletions

View File

@ -1506,15 +1506,31 @@
==
++ parse-insert ~+
;~ plug
;~(pfix whitespace parse-qualified-object)
;~ pose
;~(plug face-list ;~(pfix whitespace (jester 'values')))
;~(pfix whitespace (jester 'values'))
;~ plug
;~(pfix whitespace parse-qualified-object)
;~ pose
;~(plug face-list ;~(pfix whitespace (jester 'values')))
;~(pfix whitespace (jester 'values'))
==
;~ pfix
whitespace
(more whitespace (ifix [pal par] (more com parse-insert-value)))
==
parse-as-of
==
;~ pfix
whitespace
(more whitespace (ifix [pal par] (more com parse-insert-value)))
;~ plug
;~(pfix whitespace parse-qualified-object)
;~ pose
;~(plug face-list ;~(pfix whitespace (jester 'values')))
;~(pfix whitespace (jester 'values'))
==
;~ pfix
whitespace
(more whitespace (ifix [pal par] (more com parse-insert-value)))
==
==
==
end-or-next-command
==
++ parse-query ~+
@ -1836,10 +1852,42 @@
++ produce-insert ~+
|= a=*
^- insert:ast
?: ?=([[@ @ @ @ @] @ *] a) ::"insert rows"
(insert:ast %insert -.a ~ (insert-values:ast %data +>-.a) ~)
?: ?=([[@ @ @ @ @] [* @] *] a) ::"insert column names rows"
(insert:ast %insert -.a `+<-.a (insert-values:ast %data +>-.a) ~)
?: ?=([[[* %values * %as-of %now] @ @]] a) :: insert rows as of now
(insert:ast %insert -<.a ~ (insert-values:ast %data ->+<.a) ~)
?: ?=([[[* %values * %as-of [@ @]]] @ @] a) :: insert rows as of date
(insert:ast %insert -<.a ~ (insert-values:ast %data ->+<.a) [~ ->+>+>.a])
?: ?=([[[* %values * %as-of *]] @ @] a) :: insert rows as of offset
%: insert:ast %insert
-<.a
~
(insert-values:ast %data ->+<.a)
[~ (as-of-offset:ast %as-of-offset ->+>+<.a ->+>+>-.a)]
==
?: ?=([[* [* %values] * %as-of %now] @ @] a) :: insert columns rows as of now
(insert:ast %insert -<.a `->-<.a (insert-values:ast %data ->+<.a) ~)
?: ?=([[* [* %values] * %as-of [@ @]] @ @] a) :: insert cols rows as of date
%: insert:ast %insert
-<.a
`->-<.a
(insert-values:ast %data ->+<.a)
[~ ->+>+>.a]
==
?: ?=([[* [* %values] * %as-of *] @ @] a) :: insert cols rows as of offset
%: insert:ast %insert
-<.a
`->-<.a
(insert-values:ast %data ->+<.a)
[~ (as-of-offset:ast %as-of-offset ->+>+<.a ->+>+>-.a)]
==
?: ?=([[* %values *] @ @] a) :: insert rows
(insert:ast %insert -<.a ~ (insert-values:ast %data ->+.a) ~)
?: ?=([[* [* %values] *] @ @] a) :: insert column names rows
%: insert:ast %insert
-<.a
`->-<.a
(insert-values:ast %data ->+.a)
~
==
~|("Cannot parse insert {<a>}" !!)
++ produce-merge ~+
|= a=*
@ -2567,13 +2615,13 @@
;~ plug (cold %end-command ;~(pose ;~(plug whitespace mic) whitespace mic))
(easy ~)
==
++ alias
++ alias ~+
%+ cook
|=(a=tape (rap 3 ^-((list ,@) a)))
;~(plug alf (star ;~(pose nud alf hep)))
++ parse-alias ;~(pfix whitespace alias)
++ parse-face ;~(pfix whitespace sym)
++ face-list
++ parse-alias ~+ ;~(pfix whitespace alias)
++ parse-face ~+ ;~(pfix whitespace sym)
++ face-list ~+
;~ pfix
whitespace
%: ifix [pal par]
@ -2662,7 +2710,7 @@
;~(plug root-aura (shim 'A' 'J'))
root-aura
==
++ parse-as-of
++ parse-as-of ~+
;~ pfix
whitespace
;~ plug

View File

@ -3,41 +3,238 @@
|%
::
:: alter namespace db.ns db.ns2.table as of now
++ test-alter-namespace-02
%+ expect-eq
!> ~[[%alter-namespace database-name='db' source-namespace='ns' object-type=%table target-namespace='ns2' target-name='table' as-of=~]]
!> (parse:parse(default-database 'db1') "alter namespace db.ns transfer table db.ns2.table as of now")
:: insert
::
:: alter namespace db.ns db.ns2.table as of ~2023.12.25..7.15.0..1ef5
++ test-alter-namespace-03
:: tests 1, 2, 3, 5, and extra whitespace characters, db.ns.table, db..table, colum list, two value rows, one value row, no space around ; delimeter
:: NOTE: the parser does not check:
:: 1) validity of columns re parent table
:: 2) match column count to values count
:: 3) enforce consistent value counts across rows
++ test-insert-00
=/ expected1
:+ %transform
ctes=~
:+ :* %insert
table=[%qualified-object ship=~ database='db' namespace='ns' name='my-table']
columns=`['col1' 'col2' 'col3' 'col4' 'col5' 'col6' 'col7' 'col8' 'col9' ~]
values=[%data ~[~[[~.t 1.685.221.219] [~.rs 1.078.523.331] [~.sd 39] [~.ud 20] [~.rs 1.078.523.331] [~.p 28.242.037] [~.rs 3.226.006.979] [~.t 430.158.540.643] [~.sd 6]] ~[[~.default 32.770.348.699.510.116] [~.if 3.284.569.946] [~.ud 195.198.143.900]]]]
as-of=~
==
~
~
=/ expected2
:+ %transform
ctes=~
:+ :* %insert
table=[%qualified-object ship=~ database='db' namespace='dbo' name='my-table']
columns=`['col1' 'col2' 'col3' 'col4' 'col5' 'col6' 'col7' 'col8' 'col9' ~]
values=[%data ~[~[[~.t 1.685.221.219] [~.rs 1.078.523.331] [~.sd 39] [~.ud 20] [~.rs 1.078.523.331] [~.p 28.242.037] [~.rs 3.226.006.979] [~.t 430.158.540.643] [~.sd 6]]]]
as-of=~
==
~
~
=/ urql1 " iNsert iNto db.ns.my-table ".
"( col1 , col2 , col3 , col4 , col5 , col6 , col7 , col8 , col9 )".
" Values ('cord',.3.14,-20,20,.3.14,~nomryg-nilref,.-3.14, 'cor\\'d', --3)".
" (Default,.195.198.143.90, 195.198.143.900)"
=/ urql2 "insert into db..my-table ".
"(col1, col2, col3, col4, col5, col6, col7, col8, col9)".
"valueS ('cord',.3.14,-20,20,.3.14,~nomryg-nilref,.-3.14, 'cor\\'d', --3)"
%+ expect-eq
!> ~[[%alter-namespace database-name='db' source-namespace='ns' object-type=%table target-namespace='ns2' target-name='table' as-of=[~ ~2023.12.25..7.15.0..1ef5]]]
!> (parse:parse(default-database 'db1') "alter namespace db.ns transfer table db.ns2.table as of ~2023.12.25..7.15.0..1ef5")
!> ~[expected1 expected2]
!> (parse:parse(default-database 'other-db') (weld urql1 (weld ";" urql2)))
::
:: alter namespace db.ns db.ns2.table as of 5 days ago
++ test-alter-namespace-04
:: no columns, 3 rows
++ test-insert-01
=/ expected
:+ %transform
ctes=~
:+ :* %insert
table=[%qualified-object ship=~ database='db1' namespace='dbo' name='my-table']
columns=~
values=[%data ~[~[[~.t 1.685.221.219] [~.rs 1.078.523.331] [~.sd 39] [~.ud 20] [~.rs 1.078.523.331] [~.p 28.242.037] [~.rs 3.226.006.979] [~.t 430.158.540.643] [~.sd 6]] ~[[~.default 32.770.348.699.510.116] [~.if 3.284.569.946] [~.ud 195.198.143.900]] ~[[~.ud 2.222] [~.ud 2.222] [~.ud 195.198.143.900] [~.rs 1.078.523.331] [~.rs 3.226.006.979] [~.rd 4.614.253.070.214.989.087] [~.rd 13.837.625.107.069.764.895] [~.ux 1.205.249] [~.ub 43] [~.sd 39] [~.sd 40] [~.uw 61.764.130.813.526] [~.uw 1.870.418.170.505.042.572.886]]]]
as-of=~
==
~
~
=/ urql "insert into my-table ".
"values ('cord',.3.14,-20,20,.3.14,~nomryg-nilref,.-3.14, 'cor\\'d', --3)".
" (default,.195.198.143.90, 195.198.143.900)".
" (2.222,2222,195.198.143.900,.3.14,.-3.14,~3.14,~-3.14,0x12.6401,10.1011,-20,--20,e2O.l4Xpm,pm.l4e2O.l4Xpm)"
%+ expect-eq
!> ~[[%alter-namespace database-name='db' source-namespace='ns' object-type=%table target-namespace='ns2' target-name='table' as-of=[~ %as-of-offset 5 %days]]]
!> (parse:parse(default-database 'db1') "alter namespace db.ns transfer table db.ns2.table as of 5 days ago")
!> ~[expected]
!> (parse:parse(default-database 'db1') urql)
::
:: alter namespace ns table as of now
++ test-alter-namespace-05
:: no columns, 3 rows, as of now
++ test-insert-02
=/ expected
:+ %transform
ctes=~
:+ :* %insert
table=[%qualified-object ship=~ database='db1' namespace='dbo' name='my-table']
columns=~
values=[%data ~[~[[~.t 1.685.221.219] [~.rs 1.078.523.331] [~.sd 39] [~.ud 20] [~.rs 1.078.523.331] [~.p 28.242.037] [~.rs 3.226.006.979] [~.t 430.158.540.643] [~.sd 6]] ~[[~.default 32.770.348.699.510.116] [~.if 3.284.569.946] [~.ud 195.198.143.900]] ~[[~.ud 2.222] [~.ud 2.222] [~.ud 195.198.143.900] [~.rs 1.078.523.331] [~.rs 3.226.006.979] [~.rd 4.614.253.070.214.989.087] [~.rd 13.837.625.107.069.764.895] [~.ux 1.205.249] [~.ub 43] [~.sd 39] [~.sd 40] [~.uw 61.764.130.813.526] [~.uw 1.870.418.170.505.042.572.886]]]]
as-of=~
==
~
~
=/ urql "insert into my-table ".
"values ('cord',.3.14,-20,20,.3.14,~nomryg-nilref,.-3.14, 'cor\\'d', --3)".
" (default,.195.198.143.90, 195.198.143.900)".
" (2.222,2222,195.198.143.900,.3.14,.-3.14,~3.14,~-3.14,0x12.6401,10.1011,-20,--20,e2O.l4Xpm,pm.l4e2O.l4Xpm)".
" as of now"
%+ expect-eq
!> ~[[%alter-namespace database-name='db1' source-namespace='ns' object-type=%table target-namespace='dbo' target-name='table' as-of=~]]
!> (parse:parse(default-database 'db1') "alter namespace ns transfer table table as of now")
!> ~[expected]
!> (parse:parse(default-database 'db1') urql)
::
:: alter namespace ns table as of ~2023.12.25..7.15.0..1ef5
++ test-alter-namespace-06
:: no columns, 3 rows, as of ~2023.12.25..7.15.0..1ef5
++ test-insert-03
=/ expected
:+ %transform
ctes=~
:+ :* %insert
table=[%qualified-object ship=~ database='db1' namespace='dbo' name='my-table']
columns=~
values=[%data ~[~[[~.t 1.685.221.219] [~.rs 1.078.523.331] [~.sd 39] [~.ud 20] [~.rs 1.078.523.331] [~.p 28.242.037] [~.rs 3.226.006.979] [~.t 430.158.540.643] [~.sd 6]] ~[[~.default 32.770.348.699.510.116] [~.if 3.284.569.946] [~.ud 195.198.143.900]] ~[[~.ud 2.222] [~.ud 2.222] [~.ud 195.198.143.900] [~.rs 1.078.523.331] [~.rs 3.226.006.979] [~.rd 4.614.253.070.214.989.087] [~.rd 13.837.625.107.069.764.895] [~.ux 1.205.249] [~.ub 43] [~.sd 39] [~.sd 40] [~.uw 61.764.130.813.526] [~.uw 1.870.418.170.505.042.572.886]]]]
as-of=[~ ~2023.12.25..7.15.0..1ef5]
==
~
~
=/ urql "insert into my-table ".
"values ('cord',.3.14,-20,20,.3.14,~nomryg-nilref,.-3.14, 'cor\\'d', --3)".
" (default,.195.198.143.90, 195.198.143.900)".
" (2.222,2222,195.198.143.900,.3.14,.-3.14,~3.14,~-3.14,0x12.6401,10.1011,-20,--20,e2O.l4Xpm,pm.l4e2O.l4Xpm)".
" as of ~2023.12.25..7.15.0..1ef5"
%+ expect-eq
!> ~[[%alter-namespace database-name='db1' source-namespace='ns' object-type=%table target-namespace='dbo' target-name='table' as-of=[~ ~2023.12.25..7.15.0..1ef5]]]
!> (parse:parse(default-database 'db1') "alter namespace ns transfer table table as of ~2023.12.25..7.15.0..1ef5")
!> ~[expected]
!> (parse:parse(default-database 'db1') urql)
::
:: alter namespace ns table as of 5 days ago
++ test-alter-namespace-07
:: no columns, 3 rows, as of 5 days ago
++ test-insert-04
=/ expected
:+ %transform
ctes=~
:+ :* %insert
table=[%qualified-object ship=~ database='db1' namespace='dbo' name='my-table']
columns=~
values=[%data ~[~[[~.t 1.685.221.219] [~.rs 1.078.523.331] [~.sd 39] [~.ud 20] [~.rs 1.078.523.331] [~.p 28.242.037] [~.rs 3.226.006.979] [~.t 430.158.540.643] [~.sd 6]] ~[[~.default 32.770.348.699.510.116] [~.if 3.284.569.946] [~.ud 195.198.143.900]] ~[[~.ud 2.222] [~.ud 2.222] [~.ud 195.198.143.900] [~.rs 1.078.523.331] [~.rs 3.226.006.979] [~.rd 4.614.253.070.214.989.087] [~.rd 13.837.625.107.069.764.895] [~.ux 1.205.249] [~.ub 43] [~.sd 39] [~.sd 40] [~.uw 61.764.130.813.526] [~.uw 1.870.418.170.505.042.572.886]]]]
as-of=[~ %as-of-offset 5 %days]
==
~
~
=/ urql "insert into my-table ".
"values ('cord',.3.14,-20,20,.3.14,~nomryg-nilref,.-3.14, 'cor\\'d', --3)".
" (default,.195.198.143.90, 195.198.143.900)".
" (2.222,2222,195.198.143.900,.3.14,.-3.14,~3.14,~-3.14,0x12.6401,10.1011,-20,--20,e2O.l4Xpm,pm.l4e2O.l4Xpm)".
" as of 5 days ago"
%+ expect-eq
!> ~[[%alter-namespace database-name='db1' source-namespace='ns' object-type=%table target-namespace='dbo' target-name='table' as-of=[~ %as-of-offset 5 %days]]]
!> (parse:parse(default-database 'db1') "alter namespace ns transfer table table as of 5 days ago")
!> ~[expected]
!> (parse:parse(default-database 'db1') urql)
::
:: no columns, 3 rows, as of now
++ test-insert-05
=/ expected
:+ %transform
ctes=~
:+ :* %insert
table=[%qualified-object ship=~ database='db' namespace='ns' name='my-table']
columns=`['col1' 'col2' 'col3' 'col4' 'col5' 'col6' 'col7' 'col8' 'col9' ~]
values=[%data ~[~[[~.t 1.685.221.219] [~.rs 1.078.523.331] [~.sd 39] [~.ud 20] [~.rs 1.078.523.331] [~.p 28.242.037] [~.rs 3.226.006.979] [~.t 430.158.540.643] [~.sd 6]] ~[[~.default 32.770.348.699.510.116] [~.if 3.284.569.946] [~.ud 195.198.143.900]]]]
as-of=~
==
~
~
=/ urql "insert into db.ns.my-table ".
"(col1, col2, col3, col4, col5, col6, col7, col8, col9 )".
" values ('cord',.3.14,-20,20,.3.14,~nomryg-nilref,.-3.14, 'cor\\'d', --3)".
" (default,.195.198.143.90, 195.198.143.900) as of now"
%+ expect-eq
!> ~[expected]
!> (parse:parse(default-database 'other-db') urql)
::
:: no columns, 3 rows, as of now
++ test-insert-06
=/ expected
:+ %transform
ctes=~
:+ :* %insert
table=[%qualified-object ship=~ database='db' namespace='ns' name='my-table']
columns=`['col1' 'col2' 'col3' 'col4' 'col5' 'col6' 'col7' 'col8' 'col9' ~]
values=[%data ~[~[[~.t 1.685.221.219] [~.rs 1.078.523.331] [~.sd 39] [~.ud 20] [~.rs 1.078.523.331] [~.p 28.242.037] [~.rs 3.226.006.979] [~.t 430.158.540.643] [~.sd 6]] ~[[~.default 32.770.348.699.510.116] [~.if 3.284.569.946] [~.ud 195.198.143.900]]]]
as-of=[~ ~2023.12.25..7.15.0..1ef5]
==
~
~
=/ urql "insert into db.ns.my-table ".
"(col1, col2, col3, col4, col5, col6, col7, col8, col9 )".
" values ('cord',.3.14,-20,20,.3.14,~nomryg-nilref,.-3.14, 'cor\\'d', --3)".
" (default,.195.198.143.90, 195.198.143.900) as of ~2023.12.25..7.15.0..1ef5"
%+ expect-eq
!> ~[expected]
!> (parse:parse(default-database 'other-db') urql)
::
:: no columns, 3 rows, as of offset
++ test-insert-07
=/ expected
:+ %transform
ctes=~
:+ :* %insert
table=[%qualified-object ship=~ database='db' namespace='ns' name='my-table']
columns=`['col1' 'col2' 'col3' 'col4' 'col5' 'col6' 'col7' 'col8' 'col9' ~]
values=[%data ~[~[[~.t 1.685.221.219] [~.rs 1.078.523.331] [~.sd 39] [~.ud 20] [~.rs 1.078.523.331] [~.p 28.242.037] [~.rs 3.226.006.979] [~.t 430.158.540.643] [~.sd 6]] ~[[~.default 32.770.348.699.510.116] [~.if 3.284.569.946] [~.ud 195.198.143.900]]]]
as-of=[~ %as-of-offset 5 %days]
==
~
~
=/ urql "insert into db.ns.my-table ".
"(col1, col2, col3, col4, col5, col6, col7, col8, col9 )".
" values ('cord',.3.14,-20,20,.3.14,~nomryg-nilref,.-3.14, 'cor\\'d', --3)".
" (default,.195.198.143.90, 195.198.143.900) as of 5 days ago"
%+ expect-eq
!> ~[expected]
!> (parse:parse(default-database 'other-db') urql)
::
:: every column type, no spaces around values
++ test-insert-08
=/ expected
:+ %transform
ctes=~
:+ :* %insert
table=[%qualified-object ship=~ database='db' namespace='ns' name='my-table']
columns=~
values=[%data ~[~[[~.t 1.685.221.219] [~.p 28.242.037] [~.p 28.242.037] [~.da 170.141.184.504.830.774.788.415.618.594.688.204.800] [~.da 170.141.184.504.830.774.788.415.618.594.688.204.800] [~.dr 114.450.695.119.985.999.668.576.256] [~.dr 114.450.695.119.985.999.668.576.256] [~.if 3.284.569.946] [~.is 123.543.654.234] [~.f 0] [~.f 1] [~.f 0] [~.f 1] [~.ud 2.222] [~.ud 2.222] [~.ud 195.198.143.900] [~.rs 1.078.523.331] [~.rs 3.226.006.979] [~.rd 4.614.253.070.214.989.087] [~.rd 13.837.625.107.069.764.895] [~.ux 1.205.249] [~.ub 43] [~.sd 39] [~.sd 40] [~.uw 61.764.130.813.526] [~.uw 1.870.418.170.505.042.572.886]]]]
as-of=~
==
~
~
=/ urql "insert into db.ns.my-table ".
"values ('cord',~nomryg-nilref,nomryg-nilref,~2020.12.25..7.15.0..1ef5,2020.12.25..7.15.0..1ef5,".
"~d71.h19.m26.s24..9d55, d71.h19.m26.s24..9d55,.195.198.143.90,.0.0.0.0.0.1c.c3c6.8f5a,y,n,Y,N,".
"2.222,2222,195.198.143.900,.3.14,.-3.14,~3.14,~-3.14,0x12.6401,10.1011,-20,--20,e2O.l4Xpm,pm.l4e2O.l4Xpm)"
%+ expect-eq
!> ~[expected]
!> (parse:parse(default-database 'db1') urql)
::
:: every column type, spaces on all sides of values, comma inside cord
++ test-insert-09
=/ expected
:+ %transform
ctes=~
:+ :* %insert
table=[%qualified-object ship=~ database='db' namespace='ns' name='my-table']
columns=~
values=[%data ~[~[[~.t 430.242.426.723] [~.p 28.242.037] [~.p 28.242.037] [~.da 170.141.184.504.830.774.788.415.618.594.688.204.800] [~.da 170.141.184.504.830.774.788.415.618.594.688.204.800] [~.dr 114.450.695.119.985.999.668.576.256] [~.dr 114.450.695.119.985.999.668.576.256] [~.if 3.284.569.946] [~.is 123.543.654.234] [~.f 0] [~.f 1] [~.f 0] [~.f 1] [~.ud 2.222] [~.ud 2.222] [~.ud 195.198.143.900] [~.rs 1.078.523.331] [~.rs 3.226.006.979] [~.rd 4.614.253.070.214.989.087] [~.rd 13.837.625.107.069.764.895] [~.ux 1.205.249] [~.ub 43] [~.sd 39] [~.sd 40] [~.uw 61.764.130.813.526] [~.uw 1.870.418.170.505.042.572.886]]]]
as-of=~
==
~
~
=/ urql "insert into db.ns.my-table ".
"values ( 'cor,d' , ~nomryg-nilref , nomryg-nilref , ~2020.12.25..7.15.0..1ef5 , 2020.12.25..7.15.0..1ef5 , ".
"~d71.h19.m26.s24..9d55 , d71.h19.m26.s24..9d55 , .195.198.143.90 , .0.0.0.0.0.1c.c3c6.8f5a , y , n , Y , N , ".
"2.222 , 2222 , 195.198.143.900 , .3.14 , .-3.14 , ~3.14 , ~-3.14 , 0x12.6401 , 10.1011 , -20 , --20 , e2O.l4Xpm , pm.l4e2O.l4Xpm )"
%+ expect-eq
!> ~[expected]
!> (parse:parse(default-database 'db1') urql)
::@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

View File

@ -1203,11 +1203,29 @@
:: 1) validity of columns re parent table
:: 2) match column count to values count
:: 3) enforce consistent value counts across rows
++ test-insert-1
++ test-insert-00
=/ expected1
[%transform ctes=~ [[%insert table=[%qualified-object ship=~ database='db' namespace='ns' name='my-table'] columns=`['col1' 'col2' 'col3' 'col4' 'col5' 'col6' 'col7' 'col8' 'col9' ~] values=[%data ~[~[[~.t 1.685.221.219] [~.rs 1.078.523.331] [~.sd 39] [~.ud 20] [~.rs 1.078.523.331] [~.p 28.242.037] [~.rs 3.226.006.979] [~.t 430.158.540.643] [~.sd 6]] ~[[~.default 32.770.348.699.510.116] [~.if 3.284.569.946] [~.ud 195.198.143.900]]]] ~] ~ ~]]
:+ %transform
ctes=~
:+ :* %insert
table=[%qualified-object ship=~ database='db' namespace='ns' name='my-table']
columns=`['col1' 'col2' 'col3' 'col4' 'col5' 'col6' 'col7' 'col8' 'col9' ~]
values=[%data ~[~[[~.t 1.685.221.219] [~.rs 1.078.523.331] [~.sd 39] [~.ud 20] [~.rs 1.078.523.331] [~.p 28.242.037] [~.rs 3.226.006.979] [~.t 430.158.540.643] [~.sd 6]] ~[[~.default 32.770.348.699.510.116] [~.if 3.284.569.946] [~.ud 195.198.143.900]]]]
as-of=~
==
~
~
=/ expected2
[%transform ctes=~ [[%insert table=[%qualified-object ship=~ database='db' namespace='dbo' name='my-table'] columns=`['col1' 'col2' 'col3' 'col4' 'col5' 'col6' 'col7' 'col8' 'col9' ~] values=[%data ~[~[[~.t 1.685.221.219] [~.rs 1.078.523.331] [~.sd 39] [~.ud 20] [~.rs 1.078.523.331] [~.p 28.242.037] [~.rs 3.226.006.979] [~.t 430.158.540.643] [~.sd 6]]]] ~] ~ ~]]
:+ %transform
ctes=~
:+ :* %insert
table=[%qualified-object ship=~ database='db' namespace='dbo' name='my-table']
columns=`['col1' 'col2' 'col3' 'col4' 'col5' 'col6' 'col7' 'col8' 'col9' ~]
values=[%data ~[~[[~.t 1.685.221.219] [~.rs 1.078.523.331] [~.sd 39] [~.ud 20] [~.rs 1.078.523.331] [~.p 28.242.037] [~.rs 3.226.006.979] [~.t 430.158.540.643] [~.sd 6]]]]
as-of=~
==
~
~
=/ urql1 " iNsert iNto db.ns.my-table ".
"( col1 , col2 , col3 , col4 , col5 , col6 , col7 , col8 , col9 )".
" Values ('cord',.3.14,-20,20,.3.14,~nomryg-nilref,.-3.14, 'cor\\'d', --3)".
@ -1219,10 +1237,19 @@
!> ~[expected1 expected2]
!> (parse:parse(default-database 'other-db') (weld urql1 (weld ";" urql2)))
::
:: table, no columns, 3 rows
++ test-insert-2
:: no columns, 3 rows
++ test-insert-01
=/ expected
[%transform ctes=~ [[%insert table=[%qualified-object ship=~ database='db1' namespace='dbo' name='my-table'] columns=~ values=[%data ~[~[[~.t 1.685.221.219] [~.rs 1.078.523.331] [~.sd 39] [~.ud 20] [~.rs 1.078.523.331] [~.p 28.242.037] [~.rs 3.226.006.979] [~.t 430.158.540.643] [~.sd 6]] ~[[~.default 32.770.348.699.510.116] [~.if 3.284.569.946] [~.ud 195.198.143.900]] ~[[~.ud 2.222] [~.ud 2.222] [~.ud 195.198.143.900] [~.rs 1.078.523.331] [~.rs 3.226.006.979] [~.rd 4.614.253.070.214.989.087] [~.rd 13.837.625.107.069.764.895] [~.ux 1.205.249] [~.ub 43] [~.sd 39] [~.sd 40] [~.uw 61.764.130.813.526] [~.uw 1.870.418.170.505.042.572.886]]]] ~] ~ ~]]
:+ %transform
ctes=~
:+ :* %insert
table=[%qualified-object ship=~ database='db1' namespace='dbo' name='my-table']
columns=~
values=[%data ~[~[[~.t 1.685.221.219] [~.rs 1.078.523.331] [~.sd 39] [~.ud 20] [~.rs 1.078.523.331] [~.p 28.242.037] [~.rs 3.226.006.979] [~.t 430.158.540.643] [~.sd 6]] ~[[~.default 32.770.348.699.510.116] [~.if 3.284.569.946] [~.ud 195.198.143.900]] ~[[~.ud 2.222] [~.ud 2.222] [~.ud 195.198.143.900] [~.rs 1.078.523.331] [~.rs 3.226.006.979] [~.rd 4.614.253.070.214.989.087] [~.rd 13.837.625.107.069.764.895] [~.ux 1.205.249] [~.ub 43] [~.sd 39] [~.sd 40] [~.uw 61.764.130.813.526] [~.uw 1.870.418.170.505.042.572.886]]]]
as-of=~
==
~
~
=/ urql "insert into my-table ".
"values ('cord',.3.14,-20,20,.3.14,~nomryg-nilref,.-3.14, 'cor\\'d', --3)".
" (default,.195.198.143.90, 195.198.143.900)".
@ -1231,10 +1258,148 @@
!> ~[expected]
!> (parse:parse(default-database 'db1') urql)
::
:: every column type, no spaces around values
++ test-insert-3
:: no columns, 3 rows, as of now
++ test-insert-02
=/ expected
[%transform ctes=~ [[%insert table=[%qualified-object ship=~ database='db' namespace='ns' name='my-table'] columns=~ values=[%data ~[~[[~.t 1.685.221.219] [~.p 28.242.037] [~.p 28.242.037] [~.da 170.141.184.504.830.774.788.415.618.594.688.204.800] [~.da 170.141.184.504.830.774.788.415.618.594.688.204.800] [~.dr 114.450.695.119.985.999.668.576.256] [~.dr 114.450.695.119.985.999.668.576.256] [~.if 3.284.569.946] [~.is 123.543.654.234] [~.f 0] [~.f 1] [~.f 0] [~.f 1] [~.ud 2.222] [~.ud 2.222] [~.ud 195.198.143.900] [~.rs 1.078.523.331] [~.rs 3.226.006.979] [~.rd 4.614.253.070.214.989.087] [~.rd 13.837.625.107.069.764.895] [~.ux 1.205.249] [~.ub 43] [~.sd 39] [~.sd 40] [~.uw 61.764.130.813.526] [~.uw 1.870.418.170.505.042.572.886]]]] ~] ~ ~]]
:+ %transform
ctes=~
:+ :* %insert
table=[%qualified-object ship=~ database='db1' namespace='dbo' name='my-table']
columns=~
values=[%data ~[~[[~.t 1.685.221.219] [~.rs 1.078.523.331] [~.sd 39] [~.ud 20] [~.rs 1.078.523.331] [~.p 28.242.037] [~.rs 3.226.006.979] [~.t 430.158.540.643] [~.sd 6]] ~[[~.default 32.770.348.699.510.116] [~.if 3.284.569.946] [~.ud 195.198.143.900]] ~[[~.ud 2.222] [~.ud 2.222] [~.ud 195.198.143.900] [~.rs 1.078.523.331] [~.rs 3.226.006.979] [~.rd 4.614.253.070.214.989.087] [~.rd 13.837.625.107.069.764.895] [~.ux 1.205.249] [~.ub 43] [~.sd 39] [~.sd 40] [~.uw 61.764.130.813.526] [~.uw 1.870.418.170.505.042.572.886]]]]
as-of=~
==
~
~
=/ urql "insert into my-table ".
"values ('cord',.3.14,-20,20,.3.14,~nomryg-nilref,.-3.14, 'cor\\'d', --3)".
" (default,.195.198.143.90, 195.198.143.900)".
" (2.222,2222,195.198.143.900,.3.14,.-3.14,~3.14,~-3.14,0x12.6401,10.1011,-20,--20,e2O.l4Xpm,pm.l4e2O.l4Xpm)".
" as of now"
%+ expect-eq
!> ~[expected]
!> (parse:parse(default-database 'db1') urql)
::
:: no columns, 3 rows, as of ~2023.12.25..7.15.0..1ef5
++ test-insert-03
=/ expected
:+ %transform
ctes=~
:+ :* %insert
table=[%qualified-object ship=~ database='db1' namespace='dbo' name='my-table']
columns=~
values=[%data ~[~[[~.t 1.685.221.219] [~.rs 1.078.523.331] [~.sd 39] [~.ud 20] [~.rs 1.078.523.331] [~.p 28.242.037] [~.rs 3.226.006.979] [~.t 430.158.540.643] [~.sd 6]] ~[[~.default 32.770.348.699.510.116] [~.if 3.284.569.946] [~.ud 195.198.143.900]] ~[[~.ud 2.222] [~.ud 2.222] [~.ud 195.198.143.900] [~.rs 1.078.523.331] [~.rs 3.226.006.979] [~.rd 4.614.253.070.214.989.087] [~.rd 13.837.625.107.069.764.895] [~.ux 1.205.249] [~.ub 43] [~.sd 39] [~.sd 40] [~.uw 61.764.130.813.526] [~.uw 1.870.418.170.505.042.572.886]]]]
as-of=[~ ~2023.12.25..7.15.0..1ef5]
==
~
~
=/ urql "insert into my-table ".
"values ('cord',.3.14,-20,20,.3.14,~nomryg-nilref,.-3.14, 'cor\\'d', --3)".
" (default,.195.198.143.90, 195.198.143.900)".
" (2.222,2222,195.198.143.900,.3.14,.-3.14,~3.14,~-3.14,0x12.6401,10.1011,-20,--20,e2O.l4Xpm,pm.l4e2O.l4Xpm)".
" as of ~2023.12.25..7.15.0..1ef5"
%+ expect-eq
!> ~[expected]
!> (parse:parse(default-database 'db1') urql)
::
:: no columns, 3 rows, as of 5 days ago
++ test-insert-04
=/ expected
:+ %transform
ctes=~
:+ :* %insert
table=[%qualified-object ship=~ database='db1' namespace='dbo' name='my-table']
columns=~
values=[%data ~[~[[~.t 1.685.221.219] [~.rs 1.078.523.331] [~.sd 39] [~.ud 20] [~.rs 1.078.523.331] [~.p 28.242.037] [~.rs 3.226.006.979] [~.t 430.158.540.643] [~.sd 6]] ~[[~.default 32.770.348.699.510.116] [~.if 3.284.569.946] [~.ud 195.198.143.900]] ~[[~.ud 2.222] [~.ud 2.222] [~.ud 195.198.143.900] [~.rs 1.078.523.331] [~.rs 3.226.006.979] [~.rd 4.614.253.070.214.989.087] [~.rd 13.837.625.107.069.764.895] [~.ux 1.205.249] [~.ub 43] [~.sd 39] [~.sd 40] [~.uw 61.764.130.813.526] [~.uw 1.870.418.170.505.042.572.886]]]]
as-of=[~ %as-of-offset 5 %days]
==
~
~
=/ urql "insert into my-table ".
"values ('cord',.3.14,-20,20,.3.14,~nomryg-nilref,.-3.14, 'cor\\'d', --3)".
" (default,.195.198.143.90, 195.198.143.900)".
" (2.222,2222,195.198.143.900,.3.14,.-3.14,~3.14,~-3.14,0x12.6401,10.1011,-20,--20,e2O.l4Xpm,pm.l4e2O.l4Xpm)".
" as of 5 days ago"
%+ expect-eq
!> ~[expected]
!> (parse:parse(default-database 'db1') urql)
::
:: no columns, 3 rows, as of now
++ test-insert-05
=/ expected
:+ %transform
ctes=~
:+ :* %insert
table=[%qualified-object ship=~ database='db' namespace='ns' name='my-table']
columns=`['col1' 'col2' 'col3' 'col4' 'col5' 'col6' 'col7' 'col8' 'col9' ~]
values=[%data ~[~[[~.t 1.685.221.219] [~.rs 1.078.523.331] [~.sd 39] [~.ud 20] [~.rs 1.078.523.331] [~.p 28.242.037] [~.rs 3.226.006.979] [~.t 430.158.540.643] [~.sd 6]] ~[[~.default 32.770.348.699.510.116] [~.if 3.284.569.946] [~.ud 195.198.143.900]]]]
as-of=~
==
~
~
=/ urql "insert into db.ns.my-table ".
"(col1, col2, col3, col4, col5, col6, col7, col8, col9 )".
" values ('cord',.3.14,-20,20,.3.14,~nomryg-nilref,.-3.14, 'cor\\'d', --3)".
" (default,.195.198.143.90, 195.198.143.900) as of now"
%+ expect-eq
!> ~[expected]
!> (parse:parse(default-database 'other-db') urql)
::
:: no columns, 3 rows, as of now
++ test-insert-06
=/ expected
:+ %transform
ctes=~
:+ :* %insert
table=[%qualified-object ship=~ database='db' namespace='ns' name='my-table']
columns=`['col1' 'col2' 'col3' 'col4' 'col5' 'col6' 'col7' 'col8' 'col9' ~]
values=[%data ~[~[[~.t 1.685.221.219] [~.rs 1.078.523.331] [~.sd 39] [~.ud 20] [~.rs 1.078.523.331] [~.p 28.242.037] [~.rs 3.226.006.979] [~.t 430.158.540.643] [~.sd 6]] ~[[~.default 32.770.348.699.510.116] [~.if 3.284.569.946] [~.ud 195.198.143.900]]]]
as-of=[~ ~2023.12.25..7.15.0..1ef5]
==
~
~
=/ urql "insert into db.ns.my-table ".
"(col1, col2, col3, col4, col5, col6, col7, col8, col9 )".
" values ('cord',.3.14,-20,20,.3.14,~nomryg-nilref,.-3.14, 'cor\\'d', --3)".
" (default,.195.198.143.90, 195.198.143.900) as of ~2023.12.25..7.15.0..1ef5"
%+ expect-eq
!> ~[expected]
!> (parse:parse(default-database 'other-db') urql)
::
:: no columns, 3 rows, as of offset
++ test-insert-07
=/ expected
:+ %transform
ctes=~
:+ :* %insert
table=[%qualified-object ship=~ database='db' namespace='ns' name='my-table']
columns=`['col1' 'col2' 'col3' 'col4' 'col5' 'col6' 'col7' 'col8' 'col9' ~]
values=[%data ~[~[[~.t 1.685.221.219] [~.rs 1.078.523.331] [~.sd 39] [~.ud 20] [~.rs 1.078.523.331] [~.p 28.242.037] [~.rs 3.226.006.979] [~.t 430.158.540.643] [~.sd 6]] ~[[~.default 32.770.348.699.510.116] [~.if 3.284.569.946] [~.ud 195.198.143.900]]]]
as-of=[~ %as-of-offset 5 %days]
==
~
~
=/ urql "insert into db.ns.my-table ".
"(col1, col2, col3, col4, col5, col6, col7, col8, col9 )".
" values ('cord',.3.14,-20,20,.3.14,~nomryg-nilref,.-3.14, 'cor\\'d', --3)".
" (default,.195.198.143.90, 195.198.143.900) as of 5 days ago"
%+ expect-eq
!> ~[expected]
!> (parse:parse(default-database 'other-db') urql)
::
:: every column type, no spaces around values
++ test-insert-08
=/ expected
:+ %transform
ctes=~
:+ :* %insert
table=[%qualified-object ship=~ database='db' namespace='ns' name='my-table']
columns=~
values=[%data ~[~[[~.t 1.685.221.219] [~.p 28.242.037] [~.p 28.242.037] [~.da 170.141.184.504.830.774.788.415.618.594.688.204.800] [~.da 170.141.184.504.830.774.788.415.618.594.688.204.800] [~.dr 114.450.695.119.985.999.668.576.256] [~.dr 114.450.695.119.985.999.668.576.256] [~.if 3.284.569.946] [~.is 123.543.654.234] [~.f 0] [~.f 1] [~.f 0] [~.f 1] [~.ud 2.222] [~.ud 2.222] [~.ud 195.198.143.900] [~.rs 1.078.523.331] [~.rs 3.226.006.979] [~.rd 4.614.253.070.214.989.087] [~.rd 13.837.625.107.069.764.895] [~.ux 1.205.249] [~.ub 43] [~.sd 39] [~.sd 40] [~.uw 61.764.130.813.526] [~.uw 1.870.418.170.505.042.572.886]]]]
as-of=~
==
~
~
=/ urql "insert into db.ns.my-table ".
"values ('cord',~nomryg-nilref,nomryg-nilref,~2020.12.25..7.15.0..1ef5,2020.12.25..7.15.0..1ef5,".
"~d71.h19.m26.s24..9d55, d71.h19.m26.s24..9d55,.195.198.143.90,.0.0.0.0.0.1c.c3c6.8f5a,y,n,Y,N,".
@ -1244,9 +1409,18 @@
!> (parse:parse(default-database 'db1') urql)
::
:: every column type, spaces on all sides of values, comma inside cord
++ test-insert-4
++ test-insert-09
=/ expected
[%transform ctes=~ [[%insert table=[%qualified-object ship=~ database='db' namespace='ns' name='my-table'] columns=~ values=[%data ~[~[[~.t 430.242.426.723] [~.p 28.242.037] [~.p 28.242.037] [~.da 170.141.184.504.830.774.788.415.618.594.688.204.800] [~.da 170.141.184.504.830.774.788.415.618.594.688.204.800] [~.dr 114.450.695.119.985.999.668.576.256] [~.dr 114.450.695.119.985.999.668.576.256] [~.if 3.284.569.946] [~.is 123.543.654.234] [~.f 0] [~.f 1] [~.f 0] [~.f 1] [~.ud 2.222] [~.ud 2.222] [~.ud 195.198.143.900] [~.rs 1.078.523.331] [~.rs 3.226.006.979] [~.rd 4.614.253.070.214.989.087] [~.rd 13.837.625.107.069.764.895] [~.ux 1.205.249] [~.ub 43] [~.sd 39] [~.sd 40] [~.uw 61.764.130.813.526] [~.uw 1.870.418.170.505.042.572.886]]]] ~] ~ ~]]
:+ %transform
ctes=~
:+ :* %insert
table=[%qualified-object ship=~ database='db' namespace='ns' name='my-table']
columns=~
values=[%data ~[~[[~.t 430.242.426.723] [~.p 28.242.037] [~.p 28.242.037] [~.da 170.141.184.504.830.774.788.415.618.594.688.204.800] [~.da 170.141.184.504.830.774.788.415.618.594.688.204.800] [~.dr 114.450.695.119.985.999.668.576.256] [~.dr 114.450.695.119.985.999.668.576.256] [~.if 3.284.569.946] [~.is 123.543.654.234] [~.f 0] [~.f 1] [~.f 0] [~.f 1] [~.ud 2.222] [~.ud 2.222] [~.ud 195.198.143.900] [~.rs 1.078.523.331] [~.rs 3.226.006.979] [~.rd 4.614.253.070.214.989.087] [~.rd 13.837.625.107.069.764.895] [~.ux 1.205.249] [~.ub 43] [~.sd 39] [~.sd 40] [~.uw 61.764.130.813.526] [~.uw 1.870.418.170.505.042.572.886]]]]
as-of=~
==
~
~
=/ urql "insert into db.ns.my-table ".
"values ( 'cor,d' , ~nomryg-nilref , nomryg-nilref , ~2020.12.25..7.15.0..1ef5 , 2020.12.25..7.15.0..1ef5 , ".
"~d71.h19.m26.s24..9d55 , d71.h19.m26.s24..9d55 , .195.198.143.90 , .0.0.0.0.0.1c.c3c6.8f5a , y , n , Y , N , ".