-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 two tables from one single database (instances, and instance_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.
- Loading branch information
Showing
4 changed files
with
23 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
boto3 | ||
dataclasses-json | ||
mysql-connector-python |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters