The source code in this repository is an extension of the following tool ezpaarse-loader. It takes parsed ezpaarse files from the filesystem and uploads them to a Snowflake table, while also creating an association between a particular record and the responcibility center and department associated with said record.
- Grab the latest release
wget https://www.github.com/ulsdevteam/snowflake_ezpaarse_upload/releases/latest/download/ezpaarse_upload-release-0.1.0.tar.gz \
-O snowflake_ezpaarse_upload.tar.gz- Decompress tarball and add execute permissions (if not set)
tar -xvzf snowflake_ezpaarse_upload.tar.gz
chmod +x snowflake_ezpaarse_upload- Setup environment variable (ideally using an env file)
======.env=========
export SNOWFLAKE_AUTH=
export BASE_DIR=
====================
source .env
- Run the commands
./snowflake_ezpaarse_upload process
./snowflake_ezpaarse_upload postprocess
-
Make sure you have a dotnet compiler
-
Grab source
git clone https://github.com/ulsdevteam/snowflake_ezpaarse_upload.git
Note that main is usually stable, but for users seeking more stability or looking to get consistent results w.r.t binary, you can checkout a tag
git clone https://github.com/ulsdevteam/snowflake_ezpaarse_upload.git
git checkout 0.1.0-alpha # current latest tag
- Compile the code
dotnet publish -c Release -r linux-x64 --self-contained true /p:PublishSingleFile=true
- Copy the following files into execution environment (say,
/usr/local/snowflake_ezpaarse_upload)
# cd bin/release/<dotnet_version>/<OS_String>/publish/
cd bin/release/net10.0/linux-x64/publish/
sudo mkdir -p /usr/local/snowflake_ezpaarse_upload/
sudo cp *.so snowflake_ezpaarse_upload /usr/local/snowflake_ezpaarse_upload/
cd /usr/local/snowflake_ezpaarse_upload/
- Setup environment variable (ideally using an env file)
======.env=========
export SNOWFLAKE_AUTH=
export BASE_DIR=
====================
source .env
- Run the commands
./snowflake_ezpaarse_upload process
./snowflake_ezpaarse_upload postprocess
-
./snowflake_ezpaarse_upload process:
- Looks for files in
$BASE_DIR/pending/and uploads their content to Snowflake table - On success, files are moved to
$BASE_DIR/done/, and data can be found in tableEZPAARSE_RESULTS(schema determined by$SNOWFLAKE_AUTH_STRING) - On failure, files and intermediate files are left in
$BASE_DIR/working/, for manual intervention - Files already in
$BASE_DIR/working/or$BASE_DIR/done/are skipped
- Looks for files in
-
./snowflake_ezpaarse_upload postprocess
- Updates the table
EZPAARSE_RESULT_DEPTSwith department codes and responsibility codes for newly inserted records (also handles sponsored accounts) - Sets
user_hashcolumn of newly inserted rows ofEZPAARSE_RESUTLSusing$SALT
- Updates the table
-
SNOWFLAKE_AUTH_STRING:
- Authentication string to connect to snowflake instance
- Example:
account=<snowflake account>;user=<username>;password=<access_token>;db=<DB_NAME>;schema=<SCHEMA> - The schema is assumed to have the tables
EZPAARSE_RESULTSandEZPAARSE_RESULT_DEPTS
-
BASE_DIR:
- Directory with folders
/pending/,/working,/done/./pending/is assumed to be regualarly updated with output of ezpaarse-loader - Defaults to current working directory
- Directory with folders
-
SALT
- Arbitray UTF8 string used for generating
user_hash. - SHA256 hexdigest of provided string is used as actual salt to prevent brute force attacks for salt
- Arbitray UTF8 string used for generating
The sql commands used are hard coded into the binary, and rely on schemas internal to Pitt. For the code to be useful, it is recommended that custom sql be written as required and recompiled from source. Current sql code can be used as basis/inspiration. SQL commands live in the following places
-
For process.cs:
CommandList.GetCommands()andCommandList.GetRecoveryCommands() -
For postprocess.cs:
Main().exeStringvariable
- Copyright University of Pittsburgh
- Licensed under GPL v2, or (at your option) any later version.
- Maintained by ULS Systems Development