Database connection in Version 1 Process
Database Input (Experimental)
Instead of reading from .csv files, Carrot Transform can read directly from a database using SQLAlchemy.
- Provide a connection string via
--input-db-url. - All input tables must match the format expected by Carrot Transform.
- The
--rules-filemust still point to a local file on disk. - The
--person-filewill be interpreted as a table name, not a file path.
Examples:
--person-file C:/foo/bar/all_the_people.csvwill run:
SELECT * FROM all_the_people;--person-file demographics_makeup.csvwill run:
SELECT * FROM demographics_makeup;--input-db-url "sqlite:///./testing.db"will connect to an SQLite database in the file./testing.db
Database Workflow
Carrot-Transform can read input tables from SQLAlchemy.
This is experimental, and requires specifying a connection-string as --input-db-url instead of an input dir folder.
The person-file parameter and carrot-mapper workflow should still be used, as if working with .csv files, but carrot-transform can read from an SQLAlchemy database.
- Extract/export some rows from the various tables
- something like
SELECT column_name(s) FROM patients LIMIT 1000;is written topatients.csv
- the usual scan reports are performed on these subsets
- when carrot-transform is invoked instead of
--input-dirone specifies--input-db-urlwith a database connection string
- the
--person-fileparameter should still point to the equivalent ofperson_tablename.csv - the
--rules-fileparameter needs to refer to a file on the disk as usual
- Carrot Transform will still write data to
--output-dirand otherwise operate as normal
- The following parameters have undefined behaviour with this functionality
--write-mode--saved-person-id-file--use-input-person-ids--last-used-ids-file