Posts for: #Sql

SQLite dot commands: header command

The .headers command is crucial as might effect the way the result set is displayed. The first row would be set to the name of the columns in the output of the relevant commands like .output, .once, or even your simple standard out queries if it is set on.

.headers on

OR

.header on

Some how either of them work. You need to set it to on to enable the headers in the output of the result set. And you can turn off with .headers off.

[]

SQLite dot commands: Output mode separator command

Using the separator for the ouput

If you wanted to use a specific separator for columns and rows while displaying the result set / table, you can use the .separator dot command which can take 2 arguments, first as the separator for the column and the second for the row.

So, if we set use .separator "|" "---" then it will split the columns with | and each row with ---.

[]

SQLite dot commands: Output mode

Output mode dot command

The SQLite shell is a great way to test out and run bunch of queries, but the output might be squished or cluttered. You might need to view the output in a specific way, and the creators of SQLite were already hearing your screams.

They created not 5, not 10, but 14 different output modes, and to extend it even further, you can even use any delimiter/separator as well.

[]

SQLite dot commands: change directory command

Change directory dot command

If you are in a sqlite shell and forgot to change directory or want to navigate to a separate directory, you can do that with the .cd dot command.

.cd /path/to/directory

This is better than doing .shell cd /path/to/directory because it doesn’t open a separate terminal process. So, the .cd is persistant throughout the session, whereas the .shell cd <path> will only within that command (subprocess).

[]

SQLite dot commands: run system shell commands

Shell dot command

If you are in middle of a sqlite shell session, and you don’t want to quit the shell to run arbitrary shell command, you can simply use the .shell <command> to execute any shell commands right from within the sqlite shell. How handy is this!

.shell echo "hello, world!"

That is a lame example, but it shows you the power of the .shell command.

Let’s say I want to run a golang project, I can do this:

[]

Techstructive Weekly #57

Week #57

It was a fun week, really doubled down on learning SQLite and SQL. Shipped a bit of code and had fun creating improving metrics on the work side of things. Able to see 10% improvement in the things I have been working on the past few months. Really a good vibe week. I finally broke the barrier or imposter syndrome and whatever it might be called it while using the AI-assisted/vibe coding things.