GetWarehouseData
Given a schema and name e.g. dbo.myTable returns a DataTable copy of the warehouse table or view.
Task<DataTable> GetWarehouseData(string schema, string name);
Parameters
schema: Schema e.g. "dbo"
name: Table or view name e.g. "myTable"
Examples
The below example retrieves customer data from dbo.load_Customers. It then loops over the rows, extracting the Email field, normalising it, storing the data in a DataTable and returning it.
var customerData = await bragiCodeUtil.GetWarehouseData("dbo", "load_Customers");
var normalisedCustomerData = customerData.Copy();
normalisedCustomerData.TableName = "NormalisedCustomers";
//Add a new column to write the normalised email into
normalisedCustomerData.AddColumn("NormalisedEmail", typeof(string), 255);
foreach (var customer in normalisedCustomerData.AsEnumerable())
{
var customerEmail = (string)customer["Email"];
var normalisedCustomerEmail = customerEmail.ToUpperInvariant();
customer["NormalisedEmail"] = normalisedCustomerEmail;
}
return new BragiCodeResult(BragiCodeResultCode.Success, normalisedCustomerData);
15 September 2025