Bragi Docs Help

IBragiCodeUtil

IBragiCodeUtil provides a wide range of utilities for interacting with Bragi. When passed into your custom CodeImpl method, it acts as a bridge between your logic and Bragi’s core services, offering structured data access, source integrations, file management, communication tools, and environment metadata.

The available methods are grouped into the following categories:

1. Reading Data

  • GetWarehouseData(...): Reads data from warehouse tables or views.

  • GetWarehouseDataFromStoredProcedure(...): Executes a stored procedure and returns the result set.

  • GetWarehouseData<T>(...): Maps warehouse data directly to typed objects of type T.

  • WarehouseDataExists(...): Checks whether a warehouse object exists and is accessible.

  • GetSourceData(...): Reads from configured external systems via views or tables.

  • GetSourceDataFromStoredProcedure(...): Executes remote stored procedures.

  • SourceDataExists(...): Confirms availability and access permissions of source systems.

Note: Deprecated methods like GetWarehouseDataFromTable, GetWarehouseDataFromView, and similar GetSourceDataFromTable/View methods are retained for backward compatibility. Prefer using GetWarehouseData and GetSourceData.

2. Writing Data

BragiCodeUtil allows controlled writes to the warehouse, ideal for staged processing or batch updates.

  • TruncateWarehouseTable(...): Clears a table before reloading data.

  • AppendDataToWarehouseTable(...): Appends data to a table (requires matching columns and types).

  • BragiCodeResult: Return one or more DataTables from your component to emit output.

3. Environment and Metadata Access

  • GetEnvironmentDetails(): Returns the current Bragi environment (e.g., Dev, QA, Prod).

  • GetVariable<T>(...): Retrieves typed config or runtime variables declared in Bragi.

  • GetConnectionString(...): Resolves raw connection strings by alias.

4. File System and Source Access

Use Bragi's file abstraction layer to interact with local files, network drives, and cloud storage such as Azure Blob.

  • GetFileSources(), GetFileSource(code), GetDirectoryForFileSource(...): Access configured file sources and directories.

  • GetFileSourceHandler(...): Provides a unified handler for blob storage and file systems.

5. Communication

Supports sending email notifications, optionally with attachments or ZIP archives:

  • SendEmail(...)

  • SendEmailWithAttachment(...)

  • SendEmailWithZipContainingAttachments(...)

  • SendEmailWithAttachments(...)

6. Web and Integration

  • GetHttpClientFactory(): Provides reusable HttpClient instances for calling external APIs or scraping data.

7. Exports and Reporting to Excel

Export data sets from your component to Excel files using IronXL:

  • ExportDataTables(filePath, tables[])

  • ExportDataTables(fileSourceCode, fileName, tables[])

Each table is exported as a separate worksheet in the Excel file.

8. Logging

Add structured logs to Bragi’s event stream, visible in the Bragi UI for diagnostics and tracing:

  • LogInformation(...)

  • LogWarning(...)

  • LogError(...)

See Also

  • Variables: How to store and use Bragi-wide values.

  • BragiCodeUtil Reference: Complete list of utility methods.

  • BragiCodeExtensions: Helpers for building and manipulating DataTable objects in code.

09 March 2026