Skip to content

Commit e58372b

Browse files
authored
Feat/yaml support (#82)
* update readme * adds test and updates runner * include parquet fix
1 parent 8552873 commit e58372b

File tree

5 files changed

+105
-5
lines changed

5 files changed

+105
-5
lines changed

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,7 @@ your environment. Turning this on disables some optimizations.
574574
| ORC | `orc` | `orc` ||
575575
| Parquet | `parquet` | `parquet` ||
576576
| Avro | `avro` || `application/avro` ||
577+
| YAML | `yaml`, `yml` | `application/yaml` ||
577578
| Excel | `xlsx`, `xls` | `application/vnd.ms-excel` | If you have multiple sheets, you must [specify a sheet path](https://github.com/multiprocessio/dsq#multiple-excel-sheets). |
578579
| ODS | `ods` |`application/vnd.oasis.opendocument.spreadsheet` | If you have multiple sheets, you must [specify a sheet path](https://github.com/multiprocessio/dsq#multiple-excel-sheets). |
579580
| Apache Error Logs | NA | `text/apache2error` | Currently only works if being piped in. |
@@ -591,7 +592,7 @@ kinds of SQL queries on arbitrary (structured) data.
591592
592593
| Name | Link | Caching | Engine | Supported File Types | Binary Size |
593594
|-|---|-|-|------------------------------------------------------------------------|-|
594-
| dsq | Here | Yes | SQLite | CSV, TSV, a few variations of JSON, Parquet, Excel, ODS (OpenOffice Calc), ORC, Avro, Logs | 49M |
595+
| dsq | Here | Yes | SQLite | CSV, TSV, a few variations of JSON, Parquet, Excel, ODS (OpenOffice Calc), ORC, Avro, YAML, Logs | 49M |
595596
| q | http://harelba.github.io/q/ | Yes | SQLite | CSV, TSV | 82M |
596597
| textql | https://github.com/dinedal/textql | No | SQLite | CSV, TSV | 7.3M |
597598
| octoql | https://github.com/cube2222/octosql | No | Custom engine | JSON, CSV, Excel, Parquet | 18M |

go.mod

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ go 1.18
88
require (
99
github.com/chzyer/readline v1.5.0
1010
github.com/google/uuid v1.3.0
11-
github.com/multiprocessio/datastation/runner v0.0.0-20220616090857-d42388371862
11+
github.com/multiprocessio/datastation/runner v0.0.0-20220629131342-6165f9d14a67
1212
github.com/olekukonko/tablewriter v0.0.5
1313
)
1414

@@ -20,6 +20,7 @@ require (
2020
github.com/Azure/azure-pipeline-go v0.2.3 // indirect
2121
github.com/Azure/azure-storage-blob-go v0.14.0 // indirect
2222
github.com/ClickHouse/clickhouse-go/v2 v2.0.14 // indirect
23+
github.com/alexbrainman/odbc v0.0.0-20211220213544-9c9a2e61c5e2 // indirect
2324
github.com/apache/arrow/go/arrow v0.0.0-20211112161151-bc219186db40 // indirect
2425
github.com/apache/thrift v0.15.0 // indirect
2526
github.com/araddon/dateparse v0.0.0-20210429162001-6b43995a97de // indirect
@@ -114,4 +115,5 @@ require (
114115
google.golang.org/protobuf v1.28.0 // indirect
115116
gopkg.in/inf.v0 v0.9.1 // indirect
116117
gopkg.in/yaml.v2 v2.4.0 // indirect
118+
gopkg.in/yaml.v3 v3.0.1 // indirect
117119
)

go.sum

+9-3
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuy
9090
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
9191
github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
9292
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho=
93+
github.com/alexbrainman/odbc v0.0.0-20211220213544-9c9a2e61c5e2 h1:090cWAt7zsbdvRegKCBVwcCTghjxhUh1PK2KNSq82vw=
94+
github.com/alexbrainman/odbc v0.0.0-20211220213544-9c9a2e61c5e2/go.mod h1:c5eyz5amZqTKvY3ipqerFO/74a/8CYmXOahSr40c+Ww=
9395
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
9496
github.com/apache/arrow/go/arrow v0.0.0-20200730104253-651201b0f516/go.mod h1:QNYViu/X0HXDHw7m3KXzWSVXIbfUvJqBFe6Gj8/pYA0=
9597
github.com/apache/arrow/go/arrow v0.0.0-20211112161151-bc219186db40 h1:q4dksr6ICHXqG5hm0ZW5IHyeEJXoIJSOZeBLmWPNeIQ=
@@ -237,6 +239,8 @@ github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbV
237239
github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
238240
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
239241
github.com/go-ole/go-ole v1.2.4/go.mod h1:XCwSNxSkXRo4vlyPy93sltvi/qJq0jqQhjqQNIwKuxM=
242+
github.com/go-ole/go-ole v1.2.5 h1:t4MGB5xEDZvXI+0rMjjsfBsD7yAgp/s9ZDkL1JndXwY=
243+
github.com/go-ole/go-ole v1.2.5/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
240244
github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=
241245
github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk=
242246
github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
@@ -445,8 +449,8 @@ github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjY
445449
github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8=
446450
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 h1:RWengNIwukTxcDr9M+97sNutRR1RKhG96O6jWumTTnw=
447451
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8=
448-
github.com/multiprocessio/datastation/runner v0.0.0-20220616090857-d42388371862 h1:bgzazkNqaktd7lQqOcG6TXG1iz8S1GeGbwEcy0/Zh9k=
449-
github.com/multiprocessio/datastation/runner v0.0.0-20220616090857-d42388371862/go.mod h1:UCms/xK08DspNqDDZ5XsaIlc39AuREmeELspFYghMGI=
452+
github.com/multiprocessio/datastation/runner v0.0.0-20220629131342-6165f9d14a67 h1:MXPCwo4cL9tzW/gvUxH1eDS1ycr2frlQJmY6ssPGnOU=
453+
github.com/multiprocessio/datastation/runner v0.0.0-20220629131342-6165f9d14a67/go.mod h1:rc+sDVOazxslD0J+vqCLim1dnAcK+G6Yel/OkubUmkw=
450454
github.com/multiprocessio/go-json v0.0.0-20220308002443-61d497dd7b9e h1:NlPl7amllnQyVAkZgjBvFEkKxJSba/R8ZpaTodc7SIQ=
451455
github.com/multiprocessio/go-json v0.0.0-20220308002443-61d497dd7b9e/go.mod h1:huI4M/MrI5px/SgmXYi0a2byKikSLgDrnMQuXOqKtw4=
452456
github.com/multiprocessio/go-openoffice v0.0.0-20220110232726-064f5dda1956 h1:WVofL03Eq+z3LbDOfH5eKzu2U85LFZZngOMBlNaO/H0=
@@ -750,6 +754,7 @@ golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7w
750754
golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
751755
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
752756
golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
757+
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
753758
golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
754759
golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
755760
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
@@ -1092,8 +1097,9 @@ gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
10921097
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
10931098
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
10941099
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
1095-
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo=
10961100
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
1101+
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
1102+
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
10971103
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
10981104
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
10991105
honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=

scripts/test.py

+5
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,11 @@ def test(name, to_run, want, fail=False, sort=False, winSkip=False, within_secon
184184
want = '[{"COUNT(*)":25}]'
185185
test("Supports Avro files", to_run, want, sort=True)
186186

187+
# YAML support
188+
to_run = """./dsq ./testdata/yaml/userdata.yaml 'SELECT COUNT(*) FROM {} WHERE activated=false'"""
189+
want = '[{"COUNT(*)":3}]'
190+
test("Supports YAML files", to_run, want, sort=True)
191+
187192
# Version test
188193
to_run = """./dsq -v"""
189194
want_stderr = "dsq latest\n"

testdata/yaml/userdata.yaml

+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
- " Name ": Michelle Yost
2+
'Phone Number ': "(804) 896-6245 x269"
3+
4+
Street: '081 Senger Streets'
5+
" City ": North Jerel
6+
State: Nebraska
7+
'Zip Code ': 67681-6032
8+
'Routing Number ': '058655724'
9+
Department: Garden
10+
"Company\t": Stiedemann Inc
11+
'Created At ': '2021-10-18T04:23:27.810Z'
12+
Profile Photo: http://placeimg.com/640/480
13+
" Description": Adipisci animi nulla consectetur quia qui amet at. Hic earum nisi
14+
quam deleniti cupiditate impedit iusto. Autem et quasi amet et ut molestiae. Porro
15+
ipsam ducimus perspiciatis cumque et voluptatem sit corrupti voluptas. Ad facere
16+
unde animi numquam dolorum delectus neque consequatur. Sit cupiditate aperiam
17+
vel commodi quo aut libero.
18+
Activated: true
19+
- " Name ": Guadalupe Schimmel II
20+
'Phone Number ': 203.466.9566 x3281
21+
22+
Street: 514 Evangeline Divide
23+
" City ": East Brenden
24+
State: Ohio
25+
'Zip Code ': 77642-5209
26+
'Routing Number ': '452226335'
27+
Department: Garden
28+
"Company\t": Hammes, Medhurst and Hilpert
29+
'Created At ': '2021-10-21T07:36:16.072Z'
30+
Profile Photo: http://placeimg.com/640/480
31+
" Description": Natus illo non ratione possimus est quidem ea eius. Et accusamus
32+
recusandae cum quas eum perferendis quo modi dolorem. Doloremque quos fuga omnis
33+
placeat assumenda. Omnis quis consequatur.
34+
Activated: false
35+
- " Name ": Corey Beier
36+
'Phone Number ': 1-604-307-7955 x87013
37+
38+
Street: 77080 Kale Plaza
39+
" City ": Pico Rivera
40+
State: West Virginia
41+
'Zip Code ': '93612'
42+
'Routing Number ': '506297760'
43+
Department: Industrial
44+
"Company\t": Leffler - Prosacco
45+
'Created At ': '2021-05-15T23:53:08.950Z'
46+
Profile Photo: http://placeimg.com/640/480
47+
" Description": Et laborum voluptas officia recusandae et. Quibusdam voluptatem
48+
aspernatur accusamus in sed vero. Est est tempore sit amet cupiditate quasi. Modi
49+
id quae deleniti. Praesentium rerum corrupti architecto harum ut et ipsa velit.
50+
Delectus quis nobis officia et at veniam assumenda.
51+
Activated: false
52+
- " Name ": Margie Greenholt
53+
'Phone Number ': 962.314.6602
54+
55+
Street: 7666 Larue Manor
56+
" City ": Martinaton
57+
State: Iowa
58+
'Zip Code ': '29526'
59+
'Routing Number ': '671746379'
60+
Department: Electronics
61+
"Company\t": Jones Inc
62+
'Created At ': '2021-11-13T16:43:12.607Z'
63+
Profile Photo: http://placeimg.com/640/480
64+
" Description": Sit quia in et harum architecto aut qui consectetur. Tempora dolor
65+
earum omnis mollitia magnam quis. Dolor qui dignissimos pariatur minima veniam
66+
illo eligendi. Et expedita consectetur facilis iure. Nostrum sit natus autem tempore.
67+
Activated: true
68+
- " Name ": Delores Bahringer
69+
'Phone Number ': 567.433.0968
70+
71+
Street: 293 Deja Hills
72+
" City ": Lake Justus
73+
State: Connecticut
74+
'Zip Code ': 50214-4237
75+
'Routing Number ': '009476813'
76+
Department: Grocery
77+
"Company\t": Gaylord, Hegmann and Stehr
78+
'Created At ': '2021-04-18T04:34:02.883Z'
79+
Profile Photo: http://placeimg.com/640/480
80+
" Description": Aperiam repellat ut deleniti minus sint rerum. Quaerat eveniet
81+
tempora eius et quis libero. Quis omnis et aut suscipit ducimus corrupti. Dolorum
82+
dolore eos unde reprehenderit dicta magni blanditiis voluptate. Velit neque iste
83+
ipsam nobis dolore vel corrupti. Non suscipit et nisi rem pariatur id aut illo
84+
facilis.
85+
Activated: false
86+

0 commit comments

Comments
 (0)