Repository navigation
Add basic SELECT concept/exercise - #223
Conversation
There was a problem hiding this comment.
Are hints needed for this one? I'm open to suggestions...
Co-authored-by: Isaac Good <IsaacG@users.noreply.github.com>
| @@ -0,0 +1,15 @@ | |||
| #!/usr/bin/env bash | |||
| db_file=$1 | |||
| mapfile -t slugs < <(jq -r 'keys[]' test_data.json) | |||
There was a problem hiding this comment.
FWIW it's worth noting that this will fail on Mac with the default/older bash.
There was a problem hiding this comment.
If you want to write a guard for that:
if (( BASH_VERSINFO[0] < 5 )); then
echo "get a modern bash from Homebrew" >&2
exit 1
fiThere was a problem hiding this comment.
And jq is not standardly installed:
if ! command -v jq >/dev/null; then
echo "Required tool 'jq' is not installed" >&2
exit 1
fiThere was a problem hiding this comment.
I guess it would be nice, for users that want to run the tests locally. But I would recommend against anything Mac-specific like "Homebrew" in the error message.
There was a problem hiding this comment.
Any Linux system ought to have bash5 😄 I don't think the exact message matters much, thought for Mac users (the primary target of that message) a nudge towards Homebrew could be handy.
There was a problem hiding this comment.
Homebrew is for Linux too. I prefer it for some packages (like exercism) because it usually provides quicker access to new versions.
There was a problem hiding this comment.
And/or instructions for running the tests in Docker?
There was a problem hiding this comment.
Since we have installation instructions for Windows, it's a bad look if the first concept exercise can't run on Windows.
I fired up a Windows VM and installed sqlite (via chocolatey: did you want a PR with those instructions?) -- the sqlite3 cli's .shell command uses cmd, so we'd want a batch file equivalent of the shell script.
Anybody want to take that on?
There was a problem hiding this comment.
I might give it a try, if I can spin up a Windows VM somehow without buying a license.
There was a problem hiding this comment.
Doesn't look like anyone is too keen on translating bash to batch. Except for the guard to test for the existence of jq, I'd say carry on.
| @@ -0,0 +1,127 @@ | |||
| # Introduction | |||
There was a problem hiding this comment.
I assume this is the same as the concept introduction document. You might want to use a template. When you make changes to the concept doc, you don't have to make the same changes here but just do bin/configlet generate
There was a problem hiding this comment.
It's close, but not an exact copy:
127a128,132
>
> In addition to `=` and `BETWEEN...AND`, the `WHERE` clause supports a wide range of expressions, including comparison (`<`, `<=`, `>`, `>=`), pattern matching (`LIKE`, `GLOB`, `REGEXP`, `MATCH`), and checking for membership in a list (`IN`, `NOT IN`).
> See [SQL Language Expressions](sql-expr) for the complete documentation.
>
> [sql-expr]: https://sqlite.org/lang_expr.html
There was a problem hiding this comment.
Do you intend to reconcile the differences?
There was a problem hiding this comment.
I wasn't planning to. But I'm open to suggestions.
| @@ -0,0 +1,15 @@ | |||
| #!/usr/bin/env bash | |||
| db_file=$1 | |||
| mapfile -t slugs < <(jq -r 'keys[]' test_data.json) | |||
There was a problem hiding this comment.
If you want to write a guard for that:
if (( BASH_VERSINFO[0] < 5 )); then
echo "get a modern bash from Homebrew" >&2
exit 1
fi| @@ -0,0 +1,15 @@ | |||
| #!/usr/bin/env bash | |||
| db_file=$1 | |||
| mapfile -t slugs < <(jq -r 'keys[]' test_data.json) | |||
There was a problem hiding this comment.
And jq is not standardly installed:
if ! command -v jq >/dev/null; then
echo "Required tool 'jq' is not installed" >&2
exit 1
fi|
I was checking it out in Windows, in a git-bash environment:
I haven't really thought about a powershell translation of the results script though. |
Co-authored-by: Glenn Jackman <glenn.jackman@gmail.com>
|
@Glenn @blackk-foxx What's the status here? |
|
@glennj, I addressed your change request. Anything else? |
glennj
left a comment
There was a problem hiding this comment.
OK, let's close this out.
There was a problem hiding this comment.
Should this be removed if it is empty?
Incorporates ideas from #217, #218 and #219.