Commit Graph

57 Commits

Author SHA1 Message Date
Neil O'Toole
29e33ed2b1
Implement unique / DISTINCT (#165)
- Implemented "unique" function
- Implemented "count_unique" function
2023-03-28 00:48:24 -06:00
Neil O'Toole
fac3a27d7b
group_by() function (#163)
- `group_by()` now accepts function as argument.
- Refactored grammar.
- Broad improvements to function implementation.
2023-03-26 20:03:40 -06:00
Neil O'Toole
d9b56eea8a
Implement groupby() (#161)
* test: slq2sql more test cases; now executes the generated query

* groupby: first test case working against all DBs

* sakila: added sqlserver 2019 source

* groupby: tests for groupby synonyms

* groupby: final touches
2023-03-26 02:01:41 -06:00
Neil O'Toole
9746f4c1a2
orderby() (#159)
* wip: orderby impl

* Tests passing (note: ast.checkASTIntegrity is disabled)

* ExprNode now rendered via renderSelectorNode

* linting

* CHAGELOG for v0.27.0
2023-03-25 19:20:53 -06:00
Neil O'Toole
a1a89ee9dd
Support table and column names with spaces. (#156)
* sakila: initial test data

* sakila: more test data

* sakila: yet more test data setup

* whitespace cols: now working for sqlite

* grammar cleanup

* whitespace cols: now working inside count() func for sqlite

* whitespace cols: tests mostly passing; begining refactoring

* grammar: refactor handle

* grammar: more refactoring

* grammar: rename selElement to selector

* wip

* all tests passing

* all tests passing

* linting

* driver: implement CurrentSchema for all driver.SQLDriver impls

* driver: tests for AlterTableRename and AlterTableRenameColumn

* undo reformat of SQL

* undo reformat of SQL

* undo reformat of SQL

* undo reformat of SQL
2023-03-22 00:17:34 -06:00
Neil O'Toole
d3e6f89829
SLQ support for column aliases (#150)
* alias: more early work

* alias: test cases working for sqlite

* alias: SQL builder tests

* alias: func (col expr) aliases now working for SQLite

* linting

* CHANGELOG update

* Docs update

* Docs update

* Rename buildAst() -> buildAST()

* CHANGELOG typo
2023-03-18 22:58:00 -06:00
Neil O'Toole
161d6f9ee7
Fix to docs for cmd_sql (#148) 2023-03-15 01:43:48 -06:00
Neil O'Toole
7148505a84
CSV: check for mismatch field count vs explicitly specified column names (#147)
* csv: check for mismatch field count vs explicitly specified column names

* CHANGELOG update
2023-03-14 23:04:49 -06:00
Neil O'Toole
f71b124a1f
Testing for postgres alternate schema 2023-03-13 19:25:12 -06:00
Neil O'Toole
5d799a8820
Bug/windows file slash munge location (#140)
* Munge windows file location

* Windows filepath fix

* More Windows filepath issues

* Main workflow runs on matrix each time
2022-12-31 22:35:33 -07:00
Neil O'Toole
ed9aa38a67
Improvements to source commands (#139)
* Expose source.Set.Data() method

* jsonw.writeJSON cleaned up

* sq add now respects --json

* Location strings are subject to more scrutiny

* Ignore .db files in project dir

* sq add is more restrictive about location string

* source.RedactedLocation now uses 'xxxxx' per stdlib url.URL.Redacted()

* Update changelog for v0.23.0

* typos
2022-12-31 20:17:44 -07:00
neilotoole
48842fd0d3 linting 2022-12-24 22:00:28 -07:00
neilotoole
70e650ef87 linting 2022-12-24 21:09:20 -07:00
Neil O'Toole
a1ba6578da
"add" command supports hiding password input (#132)
* renamed cmdFlagChanged to flagChanged

* initial stdin stuff working

* wip: mostly working as expected

* Docs and lots of cleanup

* Mostly docs

* fixed behavior of source.LocationWithPassword, and tests
2022-12-24 21:04:18 -07:00
Neil O'Toole
e2a9605ec6
Chore/sqlite3 upgrade (#129)
* wip

* made progress on new SQLite type stuff

* we're getting places

* largely working now

* tidying up

* almost there

* time to deal with failing tests

* seemed to have fixed sqlserver issue

* seems to all be fixed

* minor tidy up
2022-12-23 21:05:26 -07:00
Neil O'Toole
fff01a32db
Chore/yet more mod upgrades (#128)
* gopkg.in/yaml.v3 upgrade

* emirpasic/gods@v1.18.1

* yet more module stuff
2022-12-23 14:05:24 -07:00
Neil O'Toole
8cbcaf6606
Chore/update go modules (#125)
* switched to microsoft/go-mssqldb

* upgraded go.uber.org packages

* updated ryboe/q

* more package updates
2022-12-23 11:09:06 -07:00
Neil O'Toole
fab365f43c
gofumpt on files (#122)
* gofumpt on files

* more gofumpt
2022-12-18 01:35:59 -07:00
Neil O'Toole
c778c8ced5
Linting of _test.go files (#121)
* test linting

* test linting

* test linting

* test linting
2022-12-18 00:18:35 -07:00
Neil O'Toole
f9c19785e3
Almost at the end of the linting road (#120)
* yet more linting

* yet more linting

* yet more linting

* yet more linting

* yet more linting

* yet more linting

* yet more linting

* yet more linting
2022-12-17 23:42:11 -07:00
Neil O'Toole
425702e7ba
The linting goes on forever (#119)
* linting

* yet more linting

* yet more linting

* yet more linting

* yet more linting

* yet more linting
2022-12-17 23:07:38 -07:00
Neil O'Toole
ac7535609d
Yet more linting (#118)
* lint fixes

* lint gosec
2022-12-17 22:16:10 -07:00
Neil O'Toole
08dfa10325
Errors linting (#117)
* errors linting

* errors linting

* formatting
2022-12-17 21:31:06 -07:00
Neil O'Toole
540adfac58
Lint long lines (#115)
* lint config now sorts results

* linted long lines

* linted long lines
2022-12-17 19:43:53 -07:00
Neil O'Toole
2831211ae9
Yet more linting (#114)
* wip: bunch o' linting

* bunch more linting
2022-12-17 17:51:33 -07:00
Neil O'Toole
5187e8000a
bunch of linting issues fixed (#113) 2022-12-17 16:11:33 -07:00
Neil O'Toole
e425da528f
pg constraints now scan into sql.NullString for some fields (#110) 2022-12-16 19:24:52 -07:00
Neil O'Toole
6a0878bc6b
fixed broken mysql tests (parseTime param); moved some test funcs to pkg tutil (#109) 2022-12-16 19:09:49 -07:00
Neil O'Toole
e674cdc724
change 'interface{}' to 'any' (#108) 2022-12-16 16:34:33 -07:00
Neil O'Toole
a419e0b693
Misc cleanup, goimports, updates (#107)
* debugging

* generic retry functionality; some additions to stringz.go

* fiddling with magefile_sakila

* added test lock function testh.Lock

* bunch of linting, goimports, what not
2022-12-16 15:54:09 -07:00
Neil O'Toole
d8ecff4234
drivers/mysql linting (#92) 2021-03-13 10:41:15 -07:00
Neil O'Toole
2d843c9550
MySQL DSN no longer strips driver options (#91)
* MySQL DSN no longer strips driver options
Fixes #90

* CHANGELOG update
2021-03-13 10:08:53 -07:00
Neil O'Toole
6870327508
Cobra upgrade: includes shell completion work (#81)
Addressed #80
2021-02-22 00:37:00 -07:00
Neil O'Toole
a1cfd5d525
Xlsx import handle empty sheets (#79)
* can now import XLSX with empty sheets

* renamed XLSX test article
2021-02-19 23:22:35 -07:00
Neil O'Toole
71a4f78e52
--insert now also creates the table (#78) 2021-01-03 19:56:22 -07:00
unknown
8d2398b309 close db resources 2021-01-01 18:57:07 -07:00
Neil O'Toole
5aebc04356
Fixed issues with files and databases not being closed correctly (#73)
* fiddling with scratch database close order

* files debugging

* files debugging2

* files debugging3

* files debugging 4

* files debugging 5

* didn't close the ReadCloser in csv import

* more closing cleanup
2020-12-30 11:57:58 -07:00
Neil O'Toole
8c883d276e
sq tbl truncate for postgres now outputs the number of rows truncated (#72) 2020-11-24 22:12:15 -07:00
Neil O'Toole
06900f8c84
fixed some panics with oddly-shaped xlsx imports (#71) 2020-11-02 10:40:29 -07:00
Neil O'Toole
a92b9abf34
Initial work on a JSON driver (#70)
* implementation work for json importers

* json driver checkpoint

* working on json.ParseObjectsInArray

* json.ParseObjectsInArray seems to be working

* checkpoint while tidying up ParseObjectsInArray

* more tidy checkpoint

* more tidy checkpoint 2

* tidying up ParseObjectsInArray

* tidy up

* code/docs cleanup

* more cleanup of json driver

* more cleanup of json driver

* flat json import seemingly working

* improvements to json driver

* json writer now prints empty [] for postgres empty tables
2020-10-20 09:05:43 -06:00
Neil O'Toole
0f3bc26f52
JSON driver: initial jsona driver (#69)
* jsona driver appears to be mostly working

* jsona verified as working

* minor tidy
2020-08-23 20:32:59 -06:00
Neil O'Toole
1818d50546
moved pkg libsq/sqlmodel to libsq/core/sqlmodel (#68) 2020-08-23 13:00:13 -06:00
Neil O'Toole
38be39a12f yet more pkg moving 2020-08-23 05:52:09 -06:00
Neil O'Toole
58ccfc9ded
Json driver; refactoring of core packages (#66)
* Type Detector refactor

* json driver impl; refactoring of source.Files reader et al

* working on kind detector

* significant switcheroo of packages

* partway throught refactoring Kind

* major package switcheroo for Kind
2020-08-23 04:42:15 -06:00
Neil O'Toole
b3667d60cd
implementing SQLDriver.AlterTableAddColumn (#65) 2020-08-20 21:08:59 -06:00
Neil O'Toole
9746f726f6
fixing issues with inspect/metadata (#64) 2020-08-20 14:19:16 -06:00
Neil O'Toole
929b81c6d3
MySQL "inspect" performance (#62)
* mysql inspect performance

* tidying up mysql metadata
2020-08-18 13:13:25 -06:00
Neil O'Toole
65259754f5
Improvements to metadata (sq inspect) (#61)
* improvements to sqlite source metadata query

* table metadatawriter colorization tuning; minor testh.Helper refactoring

* cleanup of metadata for multiple drivers

* more cleanup of source/table metadata

* yet more cleanup of source/table metadata

* improvements to mysql SourceMetadata

* improvements to mysql TableMetadata

* yet more fiddling with mysql metadata
2020-08-15 15:06:40 -06:00
Neil O'Toole
f00c1f2307
renamed driver.Driver impls from mysql.Driver to mysql.driveri etc (#60) 2020-08-12 21:40:03 -06:00
Neil O'Toole
48630a621f
Removed sqlx dependencies (#59) 2020-08-12 21:22:53 -06:00