All Projects → munchy-bytes → SchemaMapper

munchy-bytes / SchemaMapper

Licence: MIT license
A .NET class library that allows you to import data from different sources into a unified destination

Programming Languages

C#
18002 projects

Projects that are alternatives of or similar to SchemaMapper

winter
WInte.r is a Java framework for end-to-end data integration. The WInte.r framework implements well-known methods for data pre-processing, schema matching, identity resolution, data fusion, and result evaluation.
Stars: ✭ 101 (+146.34%)
Mutual labels:  tabular-data, data-integration, schema-matching
Dbwebapi
(Migrated from CodePlex) DbWebApi is a .Net library that implement an entirely generic Web API (RESTful) for HTTP clients to call database (Oracle & SQL Server) stored procedures or functions in a managed way out-of-the-box without any configuration or coding.
Stars: ✭ 84 (+104.88%)
Mutual labels:  sql-server, excel, oracle
Fluentmigrator
Fluent migrations framework for .NET
Stars: ✭ 2,636 (+6329.27%)
Mutual labels:  sql-server, oracle
Tds fdw
A PostgreSQL foreign data wrapper to connect to TDS databases (Sybase and Microsoft SQL Server)
Stars: ✭ 238 (+480.49%)
Mutual labels:  sql-server, databases
Office365FiddlerExtension
This Fiddler Extension is an Office 365 centric parser to efficiently troubleshoot Office 365 client application connectivity and functionality.
Stars: ✭ 23 (-43.9%)
Mutual labels:  excel, powerpoint
Sqlprovider
A general F# SQL database erasing type provider, supporting LINQ queries, schema exploration, individuals, CRUD operations and much more besides.
Stars: ✭ 423 (+931.71%)
Mutual labels:  sql-server, oracle
Transformalize
Configurable Extract, Transform, and Load
Stars: ✭ 125 (+204.88%)
Mutual labels:  sql-server, excel
database-js
Common Database Interface for Node
Stars: ✭ 58 (+41.46%)
Mutual labels:  excel, msaccess
Office Ribbonx Editor
An overhauled fork of the original Custom UI Editor for Microsoft Office, built with WPF
Stars: ✭ 205 (+400%)
Mutual labels:  excel, powerpoint
metadata
oracle,mysql,sql server 元数据管理表生成
Stars: ✭ 45 (+9.76%)
Mutual labels:  sql-server, oracle
Dev.Data
The Dev.Data.SqlDatabaseCommand is a set of components helping C# developers to execute SQL Queries and to retrieve data from SQL Server.
Stars: ✭ 15 (-63.41%)
Mutual labels:  sql-server, oracle
Entityframework.exceptions
Handle database errors easily when working with Entity Framework Core. Supports SQLServer, PostgreSQL, SQLite, Oracle and MySql
Stars: ✭ 266 (+548.78%)
Mutual labels:  sql-server, oracle
construct
A reactive graphical symbolic environment for PicoLisp
Stars: ✭ 29 (-29.27%)
Mutual labels:  excel, powerpoint
Obevo
Obevo is a database deployment tool that handles enterprise scale schemas and complexity
Stars: ✭ 192 (+368.29%)
Mutual labels:  sql-server, oracle
Dbal
Doctrine Database Abstraction Layer
Stars: ✭ 8,495 (+20619.51%)
Mutual labels:  sql-server, oracle
Sqlfiddle3
New version based on vert.x and docker
Stars: ✭ 242 (+490.24%)
Mutual labels:  sql-server, oracle
Tui.grid
🍞🔡 The Powerful Component to Display and Edit Data. Experience the Ultimate Data Transformer!
Stars: ✭ 1,859 (+4434.15%)
Mutual labels:  excel, tabular-data
Docxtemplater
Generate docx pptx and xlsx (Microsoft Word, Powerpoint, Excel documents) from templates, from Node.js, the Browser and the command line / Demo: https://www.docxtemplater.com/demo
Stars: ✭ 1,990 (+4753.66%)
Mutual labels:  excel, powerpoint
datapackage-m
Power Query M functions for working with Tabular Data Packages (Frictionless Data) in Power BI and Excel
Stars: ✭ 26 (-36.59%)
Mutual labels:  excel, tabular-data
awesome-sql
List of tools and techniques for working with relational databases.
Stars: ✭ 199 (+385.37%)
Mutual labels:  sql-server, oracle

SchemaMapper

SchemaMapper is a data integration class library that facilitates data import process from external sources having different schema definitions. It replaces creating many integration services packages by writing few lines of codes.

It imports tabular data from different data sources such as into a destination table with a user defined table schema after mapping columns between source and destination.

SchemaMapper has the ability to read data from:

  • Excel worksheets (.xls, .xlsx)
  • Flat files (.csv, .txt)
  • Access databases (.mdb, .accdb)
  • Web pages (.htm, .html)
  • JSON files (.json)
  • XML files (.xml)
  • Powerpoint presentations (.ppt, .pptx)
  • Word documents (.doc, .docx)
  • Relational databases (SQL Server, Oracle, MySQL, SQLite, SQL Server compact)

And it can export data into different destination types:

  • Flat files (.csv, .txt)
  • XML files (.xml)
  • Relational databases (SQL Server, Oracle, MySQL)

In addition, it allows users to add new computed and fixed valued columns.


Used technologies

SchemaMapper utilizes from many technologies to read data from different source such as:

Note: The needed Assemblies are found in the Assemblies folder but it is recommended to install the assemblies related to the providers that you want to connect to from the official links (mentioned above) since they can requires more related assemblies


Project details

SchemaMapper is composed of four main namespaces:

  • Converters: It reads data from external files into DataSet
  • DataCleaners: Cleans files before importing
  • SchemaMapping: Changes the imported data structure to a unified schema
  • Exporters: export tables to external sources

Wiki


NuGet Package


External links


Credits

Credits are for Munchy Bytes™


Examples

(1) Converters:

Import data from Excel file (first worksheet)

using (SchemaMapperDLL.Classes.Converters.MsExcelImport smExcel = new SchemaMapperDLL.Classes.Converters.MsExcelImport(@"U:\Passwords.xlsx","",false))
{

   //Read Excel
   smExcel.BuildConnectionString();
   var lst = smExcel.GetSheets();
   DataTable dt = smExcel.GetTableByName(lst.First(), true, 0);
   return dt;
}

Import data from Excel file using paging

using (SchemaMapperDLL.Classes.Converters.MsExcelImport smExcel = new SchemaMapperDLL.Classes.Converters.MsExcelImport(@"U:\Passwords.xlsx", "", false)){

   //Read Excel with pagging
   smExcel.BuildConnectionString();
   var lst = smExcel.GetSheets();

   int result = 1;
   int PagingStart = 1, PagingInterval = 10;

   while (result != 0){

      DataTable dt = smExcel.GetTableByNamewithPaging(lst.First(), PagingStart, PagingInterval, out result, true, 0);

      PagingStart = PagingStart + PagingInterval;

   }

}

Import data from flat file (.txt, .csv)

using (SchemaMapperDLL.Classes.Converters.FlatFileImportTools smFlat = new SchemaMapperDLL.Classes.Converters.FlatFileImportTools(@"U:\Passwords.csv",true,0))
{

   //Read flat file structure
   smFlat.BuildDataTableStructure();
   //Import data from flat file
   DataTable dt = smFlat.FillDataTable();
   int Result = dt.Rows.Count;

}

Import data from word document

using (SchemaMapperDLL.Classes.Converters.MsWordImportTools smWord = new SchemaMapperDLL.Classes.Converters.MsWordImportTools(@"U:\DocumentTable.docx", true, 0))
{

   smWord.ImportWordTablesIntoList(";");
   DataSet ds = smWord.ConvertListToTables(";");

   int ct = ds.Tables.Count;
}

(2) SchemaMapping

Initiate a SchemaMapper class

First you have to imports SchemaMapperDLL.Classes.SchemaMapping namespace.

using SchemaMapperDLL.Classes.SchemaMapping;

public SchemaMapper InitiateTestSchemaMapper(string schema, string table){

   SchemaMapper smResult = new SchemaMapper();

   smResult.TableName = table;
   smResult.SchemaName = schema;

   //Add variables
   smResult.Variables.Add(new Variable("@Today", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")));


   //Define Columns
   SchemaMapper_Column smServerCol = new SchemaMapper_Column("Server_Name", SchemaMapper_Column.ColumnDataType.Text);
   SchemaMapper_Column smUserCol = new SchemaMapper_Column("User_Name", SchemaMapper_Column.ColumnDataType.Text);
   SchemaMapper_Column smPassCol = new SchemaMapper_Column("Password", SchemaMapper_Column.ColumnDataType.Text);

   //Define a column with Fixed Value
   SchemaMapper_Column smFixedValueCol = new SchemaMapper_Column("AddedDate", SchemaMapper_Column.ColumnDataType.Text,"@Today");
   
   //Define a Column with Expression
   SchemaMapper_Column smExpressionCol = new SchemaMapper_Column("UserAndPassword",SchemaMapper_Column.ColumnDataType.Text,true,"[User_Name] + '|' + [Password]");

   //Add columns to SchemaMapper
   smResult.Columns.Add(smServerCol);
   smResult.Columns.Add(smUserCol);
   smResult.Columns.Add(smPassCol);
   smResult.Columns.Add(smFixedValueCol);
   smResult.Columns.Add(smExpressionCol);

   //Add all possible input Columns Names for each Column
   smServerCol.MappedColumns.AddRange(new[] {"server","server name","servername","Server","Server Name","ServerName"});
   smUserCol.MappedColumns.AddRange(new[] { "UserName", "User", "login", "Login", "User name" });
   smPassCol.MappedColumns.AddRange(new[] { "Password","pass", "Pass", "password" });

   //Added columns to ignore if found
   //Sys_SheetName and Sys_ExtraFields is an auto generated column when reading Excel file
   smResult.IgnoredColumns.AddRange(new[] { "Column1", "Sys_Sheetname", "Sys_ExtraFields", "Center Name" });

   //Save Schema Mapper into xml
   smResult.WriteToXml(Environment.CurrentDirectory + "\\SchemaMapper\\1.xml",true);

   return smResult;

}

Change DataTable schema and insert into SQL using stored procedure with Table variable parameter

DataTable dt = ReadExcel();

using (SchemaMapper SM = InitiateTestSchemaMapper("dbo","PasswordsTable"))
{

   bool result  = SM.ChangeTableStructure(ref dt);
   string con = @"Data Source=.\SQLINSTANCE;Initial Catalog=tempdb;integrated security=SSPI;";
 
   using (SchemaMapperDLL.Classes.Exporters.SqlServerExport exp = new SchemaMapperDLL.Classes.Exporters.SqlServerExport(con))
   {
       exp.CreateDestinationTable(SM);
       exp.InsertToSQLUsingStoredProcedure(SM, dtExcel);
   }

}

Change DataTable schema and insert into SQL using BULK Insert

DataTable dt = ReadExcel();

using (SchemaMapper SM = new SchemaMapper(Environment.CurrentDirectory + "\\SchemaMapper\\1.xml"))
{

   bool result  = SM.ChangeTableStructure(ref dt);
   string con = @"Data Source=.\SQLINSTANCE;Initial Catalog=tempdb;integrated security=SSPI;";

   using (SchemaMapperDLL.Classes.Exporters.SqlServerExport exp = new SchemaMapperDLL.Classes.Exporters.SqlServerExport(con))
   {
       exp.CreateDestinationTable(SM );
       exp.InsertUsingSQLBulk(SM, dtExcel);
   }
   
}

Read SchemaMapper class from Saved XML

using (SchemaMapper SM = new SchemaMapper("Environment.CurrentDirectory + "\\SchemaMapper\\1.xml")){

   //write your code here

}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].