This is part of a series of work to reduce the amount of setup
required for running the script and remove as many external
dependencies as possible.
By removing the dependency on MariaDB, this workflow can run in a
container without requiring a sidecar.
All the information that we need for invoicing is present in
three tables from one single database (instances, instance_{actions,extra})
which have a simple foreign key relationship, we're not relying
on any special features from MariaDB that are not present in SQLite.
It is not possible to import a mysqldump generated file into Sqlite
though, but there is a script of GitHub that performs the conversion
successfully. https://github.com/dumblob/mysql2sqlite
A follow-up patch will introduce a Dockerfile that includes the
binary and automatically does the conversion process.
Introduces a --sql-dump-file argument. That file is opened and
executed inside an in-memory sqlite3 database.
File must have been previously converted using mysql2sqlite.
Slight changes to syntax.
Distinct instead of unique()
sqlite3.Row as a row_factory instead of providing
dictionary=True to the cursor.
Additionally, I had to had a check to _clamp_time that ensures
the type argument was not of type string, and converted it if so.
I ran into an error that the provided argument (coming from the db)
was of type string somehow.
This is part of a series of work to reduce the amount of setup required for running the script and remove as many external dependencies as possible.
By removing the dependency on MariaDB, this workflow can run in a container without requiring a sidecar.
All the information that we need for invoicing is present in three tables from one single database (instances, instance_{actions,extra}) which have a simple foreign key relationship, we're not relying on any special features from MariaDB that are not present in SQLite.
It is not possible to import a
mysqldump
generated file into Sqlite though, but there is a script of GitHub that performs the conversion successfully. https://github.com/dumblob/mysql2sqliteA follow-up patch will introduce a Dockerfile that includes the binary and automatically does the conversion process.
--sql-dump-file
argument. That file is opened and executed inside an in-memory sqlite3 database.mysql2sqlite
.