SafetyCultureToDatabricks 1.0.0
dotnet add package SafetyCultureToDatabricks --version 1.0.0
NuGet\Install-Package SafetyCultureToDatabricks -Version 1.0.0
<PackageReference Include="SafetyCultureToDatabricks" Version="1.0.0" />
<PackageVersion Include="SafetyCultureToDatabricks" Version="1.0.0" />
<PackageReference Include="SafetyCultureToDatabricks" />
paket add SafetyCultureToDatabricks --version 1.0.0
#r "nuget: SafetyCultureToDatabricks, 1.0.0"
#:package SafetyCultureToDatabricks@1.0.0
#addin nuget:?package=SafetyCultureToDatabricks&version=1.0.0
#tool nuget:?package=SafetyCultureToDatabricks&version=1.0.0
SafetyCulture to Databricks
This project is a data integration tool that collects information from the SafetyCulture API v1.0 and inserts it into Databricks Delta tables. It is designed to automate the extraction, transformation, and loading (ETL) of SafetyCulture data for analytics and reporting in Databricks.
Prerequisites
For Users
- Windows 64-bit OS
- PowerShell or CMD (Command Prompt) to run the application
- Access to SafetyCulture API and token
- Databricks workspace and credentials
- No .NET installation required (if using the provided self-contained executable)
How to create tokens and find IDs
- SafetyCulture Personal Access Token:
- Log in to the SafetyCulture web app.
- Click your name in the lower-left corner.
- Select "Profile settings" from the pop-up menu.
- Click "API tokens" in the side menu.
- Click "Create a new token".
- Give the token a name and click "Create token".
- Copy the token and store it in
appsettings.json
.
- Databricks Personal Access Token:
- Log in to Databricks workspace.
- Click your user icon (top right) and select "User Settings".
- Go to "Access Tokens" and click "Generate New Token".
- Copy the generated token and use it in
appsettings.json
.
- Databricks SQL Warehouse ID:
- In Databricks workspace, go to "SQL" from the sidebar.
- Click on "SQL Warehouses".
- Select the warehouse you want to use.
- Copy the "Warehouse ID" from the warehouse details page and use it in
appsettings.json
.
For Developers
- Additionally, pre-install .NET 8 SDK (required to build or publish the application)
Configuration: appsettings.json
Before running the application, you must create and configure an appsettings.json
file. This file contains all necessary settings for SafetyCulture and Databricks integration.
Where to place
- Place
appsettings.json
in the same directory asSafetyCultureToDatabricks.exe
(the published executable). - Users can edit this file at any time to update configuration without modifying the application.
Example appsettings.json
{
"SafetyCulture": {
"BaseUrl": "https://api.safetyculture.io",
"TokenSecret": "your-safetyculture-token"
},
"Parquet": {
"InspectionsFileName": "sc_inspections.parquet",
"InspectionItemsFileName": "sc_inspection_items.parquet",
"SitesFileName": "sc_sites.parquet",
"ActionsFileName": "sc_actions.parquet",
"ActionTimelineItemsFileName": "sc_action_timeline_items.parquet",
"ActionAssigneesFileName": "sc_action_assignees.parquet",
"Users": "sc_users.parquet",
"GroupUsersFileName": "sc_group_users.parquet",
"SiteMembersFileName": "sc_site_members.parquet",
"TemplatesFileName": "sc_templates.parquet",
"TemplatePermissionsFileName": "sc_template_permissions.parquet"
},
"Databricks": {
"Host": "https://your-databricks-instance.databricks.azure.com",
"PersonalAccessToken": "your-databricks-token",
"VolumePath": "/Volumes/your_catalog/your_schema/your_volume",
"DatabaseName": "your_catalog.your_schema",
"WarehouseId": "your_warehouse_id"
},
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
},
"Console": {
"IncludeScopes": false
}
}
}
Usage
- Edit
appsettings.json
with your SafetyCulture and Databricks configuration. - The application connects to SafetyCulture Server, collects data, and saves them as Parquet files in Temp folders before uploading to Databricks.
- Run the application from PowerShell or CMD:
.\SafetyCultureToDatabricks.exe
Features
- Connects to SafetyCulture API v1.0 to retrieve inspection, action, user, site, template, and other data.
- Parses and transforms JSON responses into structured models.
- Writes data to Databricks Delta tables using Parquet format for efficient storage and querying.
- Supports incremental data extraction and merging.
- Modular architecture with separate extractors, parsers, jobs, and utilities.
Project Structure
Extraction/
— Extractors for different SafetyCulture entities (Inspections, Actions, Users, etc.).Parsers/
— JSON parsers for SafetyCulture API responses.Jobs/
— Job classes orchestrating extraction, transformation, and loading for each entity.Models/
— Data models representing SafetyCulture entities.Services/
— Service classes for API communication.Utils/
— Utility classes for configuration, Parquet writing, Databricks uploading, and SQL execution.Program.cs
— Main entry point for running jobs.appsettings.json
— Configuration file for API keys, Databricks connection, and other settings.
Prerequisites
- .NET 8.0 or later
- Access to SafetyCulture API v1.0 (API token required)
- Databricks workspace with Delta Lake enabled
Getting Started
- Clone the repository.
- Update
appsettings.json
with your SafetyCulture API token and Databricks connection details. - Build the project:
dotnet build
- Run the desired job or the main program:
dotnet run
How to Build and Publish (Self-Contained, Win-x64)
Restore dependencies
dotnet restore
Publish a self-contained release build for Windows 64-bit
dotnet publish -c Release -r win-x64 --self-contained true /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true -o publish
Output will be in the
publish
folder.Create a ZIP file of the release
Compress-Archive -Path publish\* -DestinationPath SafetyCultureToDatabricks-win-x64.zip
How to add another table later
- Create its model.
- Create its extractor returning parquet path.
- Add another
BuildXJob(...)
similar toBuildInspectionsJob
and append to the jobs array.
License
See LICENSE for details.
Contact
For questions or support, please open an issue or contact the maintainer.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- Microsoft.Extensions.Configuration (>= 9.0.8)
- Microsoft.Extensions.Configuration.Json (>= 9.0.8)
- ParquetSharp (>= 20.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
1.0.0 | 147 | 8/24/2025 |