Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion full-ifrs17-template/Constants/CalculationEngine.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,17 @@
"nbformat_minor": 5,
"cells": [
{
"id": "0lsQIC1gDEODx-OkvAl3pQ",
"cell_type": "code",
"source": [
"var projectName = \"ifrs17\";",
"\nvar environmentName = \"v1.0.0\";",
"\nvar notebookName = \"CalculationEngine\";",
"\nvar calculationEngine = $\"#!import \\\"//{projectName}/{environmentName}/{notebookName}\\\"\";"
]
],
"metadata": {},
"execution_count": 0,
"outputs": []
}
]
}
66 changes: 55 additions & 11 deletions full-ifrs17-template/Database/Configure.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -19,76 +19,120 @@
"nbformat_minor": 5,
"cells": [
{
"id": "4pCtjml9b0qsW_qdBuJO6w",
"cell_type": "markdown",
"source": [
"<p style=\"font-weight:bold;\"> <span style=\"font-size: 36px\"> DataSource Configuration </span> </p>"
]
],
"metadata": {},
"execution_count": 0,
"outputs": []
},
{
"id": "Vfn_7rax10adJW_1ZtDM8A",
"cell_type": "code",
"source": [
"#!import \"../Constants/CalculationEngine\"",
"\n#!eval calculationEngine"
]
],
"metadata": {},
"execution_count": 0,
"outputs": []
},
{
"id": "KhBa0fF-l0a93pgXYgVuFw",
"cell_type": "code",
"source": [
"#!import \"PersonalConnection\""
]
],
"metadata": {},
"execution_count": 0,
"outputs": []
},
{
"id": "Vh7nAxVvy0iUuSAGzjmDaw",
"cell_type": "code",
"source": [
"using System.Reflection;"
]
],
"metadata": {},
"execution_count": 0,
"outputs": []
},
{
"id": "ZMZQjqRWTUGnPoJJpxkdLw",
"cell_type": "markdown",
"source": [
"# Database Configure"
]
],
"metadata": {},
"execution_count": 0,
"outputs": []
},
{
"id": "M452PsrooEqiMehPCaxUyQ",
"cell_type": "code",
"source": [
"var allTypes = AppDomain.CurrentDomain.GetAssemblies().SelectMany(a => a.GetTypes())",
"\n .Where(t => (t.IsAssignableTo(typeof(IKeyed)) || t.IsAssignableTo(typeof(KeyedDimension)))",
"\n && !t.IsInterface",
"\n && !t.IsAbstract",
"\n ).ToArray();"
]
],
"metadata": {},
"execution_count": 0,
"outputs": []
},
{
"id": "0N7ABGO-n06LsiMOOHcdJw",
"cell_type": "code",
"source": [
"await DataSource.Configure().UseMsSql(opt => opt.WithConnectionString(connectionStringMsSql)",
"\n .WithTypes(allTypes)) .ConnectAsync();"
]
],
"metadata": {},
"execution_count": 0,
"outputs": []
},
{
"id": "RmBLxQdX_kOIeA0ktt94xQ",
"cell_type": "code",
"source": [
"await DataSource.CommitAsync();"
]
],
"metadata": {},
"execution_count": 0,
"outputs": []
},
{
"id": "BA0VOza8rEajIHBmKBrSXA",
"cell_type": "markdown",
"source": [
"# Reset Workspace"
]
],
"metadata": {},
"execution_count": 0,
"outputs": []
},
{
"id": "9InVK4PX5EGrE4_tARwXLw",
"cell_type": "code",
"source": [
"Workspace.Reset(x => x.ResetInitializationRules());"
]
],
"metadata": {},
"execution_count": 0,
"outputs": []
},
{
"id": "oYFbN_9RAU6NiE_F3qNY1A",
"cell_type": "code",
"source": [
""
]
],
"metadata": {},
"execution_count": 0,
"outputs": []
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,14 @@
"nbformat_minor": 5,
"cells": [
{
"id": "PacHtppMCEiAbT28F8yC9Q",
"cell_type": "code",
"source": [
"var connectionStringMsSql = \"here enter your connection string\";"
]
],
"metadata": {},
"execution_count": 0,
"outputs": []
}
]
}
36 changes: 30 additions & 6 deletions full-ifrs17-template/Database/Schema Delete.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,27 @@
"nbformat_minor": 5,
"cells": [
{
"id": "kZ8F8V4tB0Wn8FeC8OhusQ",
"cell_type": "code",
"source": [
"#!import \"PersonalConnection\""
]
],
"metadata": {},
"execution_count": 0,
"outputs": []
},
{
"id": "ns9rbHPX0kSH-ZK7AejMeA",
"cell_type": "code",
"source": [
"#r \"nuget:SqlConnection,1.0.4\""
]
],
"metadata": {},
"execution_count": 0,
"outputs": []
},
{
"id": "4PUwLlVsK0uhCCfeGwRHFg",
"cell_type": "code",
"source": [
"string[] split = connectionStringMsSql.Split(new char[] { '=', ':', ',', ';' });",
Expand All @@ -37,27 +46,42 @@
"\nstring database = split[5];",
"\nstring userID = split[9];",
"\nstring password = split[11];"
]
],
"metadata": {},
"execution_count": 0,
"outputs": []
},
{
"id": "_tMxxfxtoU-Ji32JWMtCRw",
"cell_type": "code",
"source": [
"using SQLConnection;",
"\nusing System;",
"\nusing System.Data.SqlClient;"
]
],
"metadata": {},
"execution_count": 0,
"outputs": []
},
{
"id": "4vlEnuUvfkqV87nAO3Zbsg",
"cell_type": "code",
"source": [
"string query = \"DECLARE @sql NVARCHAR(max)='' SELECT @sql += ' Drop table ' + QUOTENAME(TABLE_SCHEMA) + '.'+ QUOTENAME(TABLE_NAME) + '; 'FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE' Exec Sp_executesql @sql\";"
]
],
"metadata": {},
"execution_count": 0,
"outputs": []
},
{
"id": "wseyK5F-cE-ZP_jy2OkS8Q",
"cell_type": "code",
"source": [
"int rowAffect = SqlServer.AzureSqlConnection(serverName, database, userID, password, query);"
]
],
"metadata": {},
"execution_count": 0,
"outputs": []
}
]
}
Loading