Prophecy Orchestrate - High-performance data processing library with Go backend
Project description
Project Setup Guide
Prerequisites
1. Install Go
brew install go
2. Configure Go Environment
Add these lines to .bash_profile or .zshrc:
export GOPATH=$HOME/go
export PATH=$GOPATH/bin:$PATH
Note: After adding these lines, restart your terminal or run
source .zshrc
3. Create Go Directory Structure
mkdir -p $GOPATH/{bin,pkg,src}
4. Install Dependencies
-
Install Protobuf:
brew install protobuf
-
Install cmake
brew install cmake
-
Install gRPC:
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.5.1
-
Install Project Dependencies:
make install-dependencies
-
init/update all submodules
git submodule update --init --recursive
Development
Building and Testing
-
Build and run the project:
make all -
Run unit tests:
make test
Running the Server Locally
1. Run Orchestrator
export RESOURCEMANAGER_TYPE=local
export LOG_FORMAT=console
go run ./pkg/cmd
2. Run Task Coordinator
export RESOURCEMANAGER_TYPE=local
export LOG_FORMAT=console
export MODE=task_coordinator
export DUMPTRACEONEXIT=true
export PPROFADDR=":6061"
go run ./pkg/cmd
Logging Options
- For JSON logging:
unset LOG_FORMAT - For trace logging: Add
-traceflag - For debug logging: Add
-debugflag
Running with Docker
-
Build Docker images:
make docker-build -
Run with docker-compose:
./run_docker_compose_test.sh
Monitoring and Administration
Admin UI
- View Pipelines, Runs & Details: http://localhost:9089/engine/view
- Debug Profiler: http://localhost:6060/debug/pprof
Debugging
go tool pprof profile
(pprof)> tree
(pprof)> web
Runtime Configuration
Set log level dynamically:
curl --location 'http://localhost:9089/log/level' \
--header 'Content-Type: application/json' \
--data '{
"level": "debug"
}'
Gem Debugging
Snowflake
CLI
- export table from snowflake
COPY INTO '@%TUSHAR/prophecy/data1row' from tushar file_format = (type = parquet) OVERWRITE = TRUE;
- download the parquet file in local
pip install snowflake-cli-labs
snow sql --query 'GET @%TUSHAR/prophecy/data file:///Users/tushargarg/;'
Prophecy DBT
A lightweight, stateful DBT parser and template resolver that leverages dbt-core libraries while providing a simpler API.
Overview
Prophecy DBT is designed to create a lighter, stateful version of DBT that can be used for template resolution, parsing, and executing SQL commands with materialization. It leverages dbt-core's libraries when available, providing the best of both worlds:
- Compatibility with core DBT functionality
- Lightweight processing when full DBT functionality isn't needed
- Stateful handling of models, macros, and sources
- Simple API for integration with web services and applications
Features
- Optimized Jinja Resolution: Uses dbt-core's built-in Jinja rendering when available, with fallback to a lightweight implementation
- Stateful Entity Management: Tracks models, macros, and sources in memory for efficient updates
- Multiple Access Methods: CLI, REST API, and GRPC services for integration
- Smart Materialization: Generates proper SQL for table/view creation based on model configuration
- High Performance: Designed for speed and efficiency when processing templates
- Automatic DBT Context: Injects appropriate context variables based on DBT project structure
Installation
# Basic installation
pip install prophecy_dbt
Start Server
export LOG_FORMAT=console && export ENABLE_PRODUCTION_DEBUGGING=true && export DBT_DBT_EAGER_LOAD_PROFILE=false && python -m server --log-level DEBUG
Usage
Command Line
# Resolve a simple template
prophecy-dbt resolve-template "SELECT * FROM {{ ref('model_name') }}" --project-dir ./my_dbt_project
# Resolve a file with materialization
prophecy-dbt resolve-file ./models/my_model.sql --materialization --project-dir ./my_dbt_project
Python API
from parser.jinja_resolve import resolve_template, resolve_with_materialization
# Simple template resolution
sql = resolve_template(
template="SELECT * FROM {{ ref('model_name') }}",
project_dir="./my_dbt_project"
)
REST API
Make a request for Materiazliation:
curl --location 'http://localhost:50054/resolve_jinja_templates' \
--header 'Content-Type: application/json' \
--data '{
"entity":"orders",
"mode": "RUN",
"entity_type": "MODEL",
"parameters": {
"test_amount": "200"
}
}'
Make a request for compiled DBT Code:
curl --location 'http://localhost:50054/resolve_jinja_templates' \
--header 'Content-Type: application/json' \
--data '{
"entity":"orders",
"mode": "COMPILE",
"entity_type": "MODEL",
"parameters": {
"test_amount": "200"
}
}'
Architecture
The package is designed with a layered architecture:
- Core Layer: Basic Jinja resolution without DBT dependencies
- DBT Integration Layer: Enhanced resolution using dbt-core libraries
- Stateful Layer: Adds in-memory tracking of entities and dependencies
- API Layer: Provides various interfaces (CLI, REST, GRPC)
This design allows the package to work with or without dbt-core installed, adapting to the available dependencies.
How It Works
The package includes a smart integration with dbt-core that leverages the following components:
- dbt.clients.jinja: For optimal Jinja rendering
- dbt.context: For providing the proper variables and functions
- dbt.parser: For analyzing SQL and extracting metadata
When dbt-core is not available, it falls back to a custom implementation that covers the essential functionality.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file prophecy_orchestrate-1.0.19.dev50-py3-none-manylinux_2_17_x86_64.whl.
File metadata
- Download URL: prophecy_orchestrate-1.0.19.dev50-py3-none-manylinux_2_17_x86_64.whl
- Upload date:
- Size: 104.6 MB
- Tags: Python 3, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e7c4878904f59fdbbb55017e0cfe5527a24b5c9bee6117081e1701ef91655f98
|
|
| MD5 |
672177d4a83ca6ec1db06d0a1c1ead05
|
|
| BLAKE2b-256 |
c72fc38b097dc14e40a9fa867f587919d9889265fa4b366c22056a0c0980f981
|
File details
Details for the file prophecy_orchestrate-1.0.19.dev50-cp312-cp312-manylinux_2_17_x86_64.whl.
File metadata
- Download URL: prophecy_orchestrate-1.0.19.dev50-cp312-cp312-manylinux_2_17_x86_64.whl
- Upload date:
- Size: 97.9 MB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f445961fc260eb2236f32e8ccf71af823ec860207566ff4025b3b10126d909cb
|
|
| MD5 |
4a1ef1f57999f96b1e76edf58c31fa3d
|
|
| BLAKE2b-256 |
482b867b6be82980251e7593e4b24760153b01634536c0b20da44ff2063aa6de
|