|
2 | 2 |
|
3 | 3 | [](https://github.com/calvinjmin/databricks-sdk-cpp/releases/latest) |
4 | 4 | [](https://opensource.org/licenses/MIT) |
| 5 | +[](https://calvinjmin.github.io/databricks-sdk-cpp/) |
5 | 6 |
|
6 | 7 | A C++ SDK for Databricks, providing an interface for interacting with Databricks services. |
7 | 8 |
|
8 | | -**Latest Release **: [v0.1.0 ](https://github.com/calvinjmin/databricks-sdk-cpp/releases/tag/v0.1.0) | **Author **: Calvin Min ( [email protected]) |
| 9 | +**Latest Release**: [v0.1.0](https://github.com/calvinjmin/databricks-sdk-cpp/releases/tag/v0.1.0) |
| 10 | + |
| 11 | +**Author **: Calvin Min ( [email protected]) |
| 12 | + |
| 13 | +--- |
9 | 14 |
|
10 | 15 | ## Table of Contents |
11 | 16 |
|
@@ -112,7 +117,7 @@ include(FetchContent) |
112 | 117 | FetchContent_Declare( |
113 | 118 | databricks_sdk |
114 | 119 | GIT_REPOSITORY https://github.com/calvinjmin/databricks-sdk-cpp.git |
115 | | - GIT_TAG v0.1.0 # or use 'main' for latest |
| 120 | + GIT_TAG main # latest tag or declare a specific version like 0.1.0 |
116 | 121 | ) |
117 | 122 |
|
118 | 123 | FetchContent_MakeAvailable(databricks_sdk) |
@@ -494,6 +499,9 @@ After building with `BUILD_EXAMPLES=ON`, examples are organized by feature: |
494 | 499 | ```bash |
495 | 500 | # Simple SQL query |
496 | 501 | ./examples/simple_query |
| 502 | + |
| 503 | +# Jobs API - list jobs, get details, trigger runs |
| 504 | +./examples/jobs_example |
497 | 505 | ``` |
498 | 506 |
|
499 | 507 | ### Connection Pooling Examples |
@@ -571,6 +579,58 @@ Async operations reduce perceived latency by performing work in the background: |
571 | 579 |
|
572 | 580 | ## Advanced Usage |
573 | 581 |
|
| 582 | +### Jobs API |
| 583 | + |
| 584 | +Interact with Databricks Jobs to automate and orchestrate data workflows: |
| 585 | + |
| 586 | +```cpp |
| 587 | +#include <databricks/jobs.h> |
| 588 | +#include <databricks/config.h> |
| 589 | + |
| 590 | +int main() { |
| 591 | + // Load auth configuration |
| 592 | + databricks::AuthConfig auth = databricks::AuthConfig::from_environment(); |
| 593 | + |
| 594 | + // Create Jobs API client |
| 595 | + databricks::Jobs jobs(auth); |
| 596 | + |
| 597 | + // List all jobs |
| 598 | + auto job_list = jobs.list_jobs(25, 0); |
| 599 | + for (const auto& job : job_list) { |
| 600 | + std::cout << "Job: " << job.name |
| 601 | + << " (ID: " << job.job_id << ")" << std::endl; |
| 602 | + } |
| 603 | + |
| 604 | + // Get specific job details |
| 605 | + auto job = jobs.get_job(123456789); |
| 606 | + std::cout << "Created by: " << job.creator_user_name << std::endl; |
| 607 | + |
| 608 | + // Trigger a job run with parameters |
| 609 | + std::map<std::string, std::string> params; |
| 610 | + params["date"] = "2024-01-01"; |
| 611 | + params["environment"] = "production"; |
| 612 | + |
| 613 | + uint64_t run_id = jobs.run_now(123456789, params); |
| 614 | + std::cout << "Started run: " << run_id << std::endl; |
| 615 | + |
| 616 | + return 0; |
| 617 | +} |
| 618 | +``` |
| 619 | + |
| 620 | +**Key Features:** |
| 621 | +- **List jobs**: Paginated listing with limit/offset support |
| 622 | +- **Get job details**: Retrieve full job configuration and metadata |
| 623 | +- **Trigger runs**: Start jobs with optional notebook parameters |
| 624 | +- **Type-safe IDs**: Uses `uint64_t` to correctly handle large job IDs |
| 625 | +- **JSON parsing**: Built on `nlohmann/json` for reliable parsing |
| 626 | + |
| 627 | +**API Compatibility:** |
| 628 | +- Uses Jobs API 2.2 for full feature support including pagination |
| 629 | +- Timestamps returned as Unix milliseconds (`uint64_t`) |
| 630 | +- Automatic error handling with descriptive messages |
| 631 | + |
| 632 | +For a complete example, see `examples/basic/jobs_example.cpp`. |
| 633 | + |
574 | 634 | ### Direct ConnectionPool Management |
575 | 635 |
|
576 | 636 | For advanced users who need fine-grained control over connection pools: |
@@ -605,24 +665,60 @@ std::cout << "Available: " << stats.available_connections << std::endl; |
605 | 665 |
|
606 | 666 | ## Documentation |
607 | 667 |
|
608 | | -Generate API documentation from code comments: |
| 668 | +The SDK includes comprehensive API documentation generated from code comments using Doxygen. |
| 669 | +
|
| 670 | +### 📚 View Online Documentation |
| 671 | +
|
| 672 | +**Live Documentation**: [https://calvinjmin.github.io/databricks-sdk-cpp/](https://calvinjmin.github.io/databricks-sdk-cpp/) |
| 673 | +
|
| 674 | +The documentation is automatically built and published via GitHub Actions whenever changes are pushed to the `main` branch. |
| 675 | +
|
| 676 | +### Generate Documentation Locally |
609 | 677 |
|
610 | 678 | ```bash |
611 | | -# Install Doxygen (macOS) |
612 | | -brew install doxygen |
| 679 | +# Install Doxygen |
| 680 | +brew install doxygen # macOS |
| 681 | +# or: sudo apt-get install doxygen # Linux |
613 | 682 |
|
614 | | -# Generate documentation |
615 | | -make docs |
| 683 | +# Generate docs (creates docs/html/) |
| 684 | +doxygen Doxyfile |
616 | 685 |
|
617 | | -# Open documentation in browser |
618 | | -open docs/html/index.html |
| 686 | +# View in browser |
| 687 | +open docs/html/index.html # macOS |
| 688 | +# or: xdg-open docs/html/index.html # Linux |
| 689 | +``` |
| 690 | + |
| 691 | +### Documentation Features |
| 692 | + |
| 693 | +The generated documentation includes: |
| 694 | + |
| 695 | +- **Complete API Reference**: All public classes, methods, and structs with detailed descriptions |
| 696 | +- **README Integration**: Full README displayed as the main landing page |
| 697 | +- **Code Examples**: Inline examples from header comments |
| 698 | +- **Jobs API Documentation**: Full reference for `databricks::Jobs`, `Job`, and `JobRun` types |
| 699 | +- **SQL Client Documentation**: Complete `databricks::Client` API reference |
| 700 | +- **Connection Pooling**: `databricks::ConnectionPool` and configuration types |
| 701 | +- **Source Browser**: Browse source code with syntax highlighting |
| 702 | +- **Search Functionality**: Quick search across all documentation |
| 703 | +- **Cross-references**: Navigate between related classes and methods |
| 704 | + |
| 705 | +### Quick Links (After Generation) |
| 706 | + |
| 707 | +- **Main Page**: `docs/html/index.html` - README and getting started |
| 708 | +- **Classes**: `docs/html/annotated.html` - All classes and structs |
| 709 | +- **Jobs API**: `docs/html/classdatabricks_1_1_jobs.html` - Jobs API reference |
| 710 | +- **Client API**: `docs/html/classdatabricks_1_1_client.html` - SQL client reference |
| 711 | +- **Files**: `docs/html/files.html` - Browse by file |
| 712 | + |
| 713 | +### Example: Viewing Jobs API Docs |
| 714 | + |
| 715 | +```bash |
| 716 | +# Generate and open Jobs API documentation |
| 717 | +doxygen Doxyfile |
| 718 | +open docs/html/classdatabricks_1_1_jobs.html |
619 | 719 | ``` |
620 | 720 |
|
621 | | -The documentation includes: |
622 | | -- API reference for all classes and methods |
623 | | -- Code examples from comments |
624 | | -- Class diagrams and inheritance trees |
625 | | -- Search functionality |
| 721 | +The documentation is automatically generated from the inline comments in header files, ensuring it stays synchronized with the code. |
626 | 722 |
|
627 | 723 | ## License |
628 | 724 |
|
|
0 commit comments