etlite

command module
v0.0.0-...-d0f7b5f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2018 License: MIT Imports: 11 Imported by: 0

README

super duper pre pre alpha.

extension of sqlite language with import/export

Brief nonnormative rundown of the syntax that is subject to change at whim and probably without updating this document. For the time being further information will have to refer to the source. (Plan to have it locked down with machine-checked documentation and examples for beta).

ETLite is a superset of a (large) subset of SQLite.

These additional statements are added:

  • USE [DB|DATABASE] name - allows an ETLite script to specify an existing SQLite database to be the master db of the connection. (Must be first statement in script).
  • DISPLAY [TO device] [AS format] [FRAME name] - allows changing the output format and IO redirection.
  • IMPORT [TEMP|TEMPORARY] [table] [(col1, col2, ...)] [FROM device] [WITH format] [FRAME name] [LIMIT n] [OFFSET n] - allows reading formatted data into a table.
  • ASSERT message, subquery - halt execution based on result of subquery.

Additionally, the @ placeholders work as follows: For @n where n is a natural number, this is the nth command line argument to the script or NULL. Otherwise @X refers to the environment variable X (or NULL if not set). Placeholders cannot be used in triggers.

For both DISPLAY and IMPORT, a FRAME names a table in a multitable format. (None are supported currently).

Currently the formats are

  • CSV [STRICT] [DELIM rune] [EOL DEFAULT|LF|UNIX|CRLF|WINDOWS] [NULL string] [HDR|HEADER]
  • RAW [STRICT] [DELIM rune] [EOL DEFAULT|LF|UNIX|CRLF|WINDOWS] [NULL string] [NOHDR|NOHEADER]

NULL is a string used to indicate an SQL NULL value in the string output. If not set the empty string and NULL are the same.

RAW is CSV without a facility for quoting and \t as the default delimiter.

The device is either FILE filename or STDIN/STDOUT.

Any SQLite that returns rows is exported using the current DISPLAY settings.

As a statement, IMPORT creates a table and imports data into it.

IMPORT may be used in most subqueries (outside of triggers), which creates and fills temporary tables, executes the desugared SQLite then drops the tables.

The special form CREATE TABLE t (cols) FROM IMPORT [...] imports data directly into t.

The special form INSERT INTO t (cols) USING IMPORT [...] imports directly into t without creating any tables. It is required to specify the cols on the INSERT portion.

ASSERT ends the script if the scalar subquery returns anything other than 1 and prints message. If instead of a subquery an @ placeholder is given, it asserts the existence of that arg or env variable.

Otherwise, all SQLite is valid except for

  • EXPLAIN/ANALYZE
  • ROLLBACK (handled automatically)
  • placeholders (except @ which is handled differently as noted above)

SQLite is compiled with ICU/Rtree/FTS5/json/dbstat/soundex, a regexp function that links to PCRE, and the series, nextchar, and spellfix add-ons from ext/misc in the SQLite repo.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
internal
ast
Package ast describes the extended and final AST of the SQLite superset.
Package ast describes the extended and final AST of the SQLite superset.
ast/internal/writer
Package writer exports a simplified and customized writer.
Package writer exports a simplified and customized writer.
compile
Package compile collects, compiles, and verifies the semantics of nodes read from a chan.
Package compile collects, compiles, and verifies the semantics of nodes read from a chan.
device
Package stdio wraps stdin, stdout, and file operations with the semantics required elsewhere in this system and that work around any consequences of the sys.env table being user-writable.
Package stdio wraps stdin, stdout, and file operations with the semantics required elsewhere in this system and that work around any consequences of the sys.env table being user-writable.
device/file
Package file implements file devices.
Package file implements file devices.
device/std
Package std supplies devices for std.In and std.Out.
Package std supplies devices for std.In and std.Out.
driver
Package driver is a limited, specialized binding to a customized SQLite.
Package driver is a limited, specialized binding to a customized SQLite.
format/rawfmt
Package rawfmt defines encoding and decoding of the raw format.
Package rawfmt defines encoding and decoding of the raw format.
internal/digital
Package digital checks whether a string consists of only ASCII digits.
Package digital checks whether a string consists of only ASCII digits.
internal/eol
Package eol defines the platform specific default end of line encoding.
Package eol defines the platform specific default end of line encoding.
internal/errint
Package errint provides additional context for error messages that are the result of a programming error.
Package errint provides additional context for error messages that are the result of a programming error.
internal/errsys
Package errsys provides additional context for error messages that are the result of the underlying OS.
Package errsys provides additional context for error messages that are the result of the underlying OS.
internal/errusr
Package errusr wraps user errors with token position information.
Package errusr wraps user errors with token position information.
internal/escape
Package escape escapes strings for use by Sqlite.
Package escape escapes strings for use by Sqlite.
internal/null
Package null handles marshalling of SQL NULL to and from plain text for formats that do not have a native definition equivalent to NULL.
Package null handles marshalling of SQL NULL to and from plain text for formats that do not have a native definition equivalent to NULL.
internal/savepoint
Package savepoint models the savepoint stack and transaction support.
Package savepoint models the savepoint stack and transaction support.
internal/synth
Package synth provides sql synthesis helpers needed by the compiler and vm.
Package synth provides sql synthesis helpers needed by the compiler and vm.
lex
Package lex is a mostly compliant SQLite lexer.
Package lex is a mostly compliant SQLite lexer.
parse
Package parse parses a stream of lexemes into an ast.
Package parse parses a stream of lexemes into an ast.
parse/internal/runefrom
Package runefrom provides a helper for converting an arbitrary string to a single rune.
Package runefrom provides a helper for converting an arbitrary string to a single rune.
virt/internal/sysdb
Package sysdb encapsulates the sys database ETLite creates before running.
Package sysdb encapsulates the sys database ETLite creates before running.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL