SlideShare a Scribd company logo
1 of 14
Download to read offline
marco kiesewettermarco kiesewetter
SIMPLE ETL
SOLUTION
Extracting,Transforming, Loading
Data From Any System To SQL
Server Right FromYour Desktop.
marco kiesewettermarco kiesewetter
OVERVIEW
 Why use manual ETL from your desktop?
 A common issue to deal with
 Example: Salesforce to SQL - a simple way to load fresh
data
 Recap:What is ETL?
 Extract data from outside source, i.e. Salesforce.com
 Transform data to fit operational needs
 Load data into a data storage system such as a SQL database, data mart or
data warehouse
marco kiesewettermarco kiesewetter
WHY USE MANUAL ETL
 Business Analysts, Financial Analysts and BI Developers run
into two common situations where a manual desktop
upload is needed:
 The data does not yet exist in SQL
 Often it is helpful to get a sample dataset into SQL to test and justify an
new data source that is needed.
 Development using this new data source can begin immediately, even before
the automated ETL job is set up by your IT department
 The data needs to be refreshed off-schedule
 Many ETL jobs run once or twice a day. If an extra refresh is needed at
times, a manual upload of ‘fresh’ data can be the quickest way
marco kiesewettermarco kiesewetter
A COMMON ISSUE TO DEAL WITH
One of the most common issues is the formatting
of the raw data
 Field delimiters & row delimiters may not be standard
 The use of quotations and commas in text fields can cause delimiter
recognition to fail
 SQL Server does only support CSV upload if the data is in a specific
format
 Salesforce row delimiters are not recognized
 Quotes only work if all fields in a column are enclosed in quotes
marco kiesewettermarco kiesewetter
SALESFORCE TO SQL - A SIMPLE WAY
TO LOAD FRESH DATA
Example
marco kiesewettermarco kiesewetter
AUTOMATION & SIMPLICITY
Requirement:
 Automation – very little manual effort
 Simplicity – anyone can run the update
marco kiesewettermarco kiesewetter
STEP 1: THE EXTRACT FILE
Download the Salesforce report results you want
to upload
 Download as CSV
 Save in an accessible network path
 The SQL server has to be able to access it.
 Use a filename that does not change
 Avoid dates etc. in the file name.
 Scripts will access this filename in this folder. For an update simply
overwrite this file.
marco kiesewettermarco kiesewetter
STEP 2: STANDARDIZE THE FILE
 Now we are usingWindows PowerShell to prepare the csv for upload
 Often we will have commas in comments or other text fields.We should change the
field delimiter to a different symbol.The pipe “|” is a good option.
 First we will need change all existing pipes to something else in order to make the
pipe symbol unique as field delimiter.
 In the example below I simply remove the pipes by replacing them with an empty
string, they can be replaced with anything else, though.
# Define the file but note that I do not add “.csv”
$csvfile = 'serverfoldersalesforceExtract'
# Now we replace all pipes
get-content ($csvfile + ".csv") | % {$_ -replace "|", ""} |
out-file ($csvfile +" (no Pipes).csv") -force -encoding ascii
marco kiesewettermarco kiesewetter
STEP 2: STANDARDIZE THE FILE
 Next we will change the delimiter and standardize the CSV file:
 The file salesforceExtract (standardized).csv has now all fields in quotes.
Since we do not use commas as delimiters and all pipes were removed
from all text fields, we can safely remove all quotes from the file:
# Make standard CSV but use Pipes as delimiter
Import-csv -path ($csvfile + " (no Pipes).csv") -Delimiter ','
| Export-CSV -path ($csvfile + " (standardized).csv") -
Delimiter '|'
# Remove all Quotes (“)
get-content ($csvfile + " (standardized).csv") | % { $_ -
replace '"',""} | Set-Content ($csvfile + " (upload).csv")
marco kiesewettermarco kiesewetter
STEP 3: UPLOAD TO SQL
 Finally, we upload this prepared CSV to SQL server using
Microsoft SQL Server Management Studio
 For this we use the BULK INSERT command
 In most cases we may upload a complete new data set.The easiest way to
handle this is by deleting the old table and re-creating it.
 Another advantage for doing this is the ease with which new fields can be
added or the variable types of fields can be changed.The new creation of
the table allows for any such adjustments.
 Note that the BULK INSERT functionality is a server-side permission
setting and may need to be activated for your login.
marco kiesewettermarco kiesewetter
STEP 3: UPLOAD TO SQL
 Here is an example SQL
script you can adjust to
fit your needs:
use YourDB
drop table [dbo].[YourTable]
go
create table [dbo].[YourTable](
Field1 nVARCHAR(255) null,
Field2 datetime null,
Field3 float null,
go
bulk insert YourTable
from 'serverfoldersalesfoceExtract
(upload).csv'
With (
fieldterminator = '|',
rowterminator = 'n',
firstrow = 2
)
go
marco kiesewettermarco kiesewetter
STEP 4: PUTTING IT ALLTOGETHER
 Put all the PowerShell commands into a text file with the extension .ps1
 Put the SQL script into a text file with the extension .sql
 Now create a batch script (example below, file extension .bat) that runs
all of the above commands and place everything in the same folder in
which you save your extracted CSV from Salesforce
@echo off
cls
echo Standardizing the CSV file...
powershell.exe -noprofile -ExecutionPolicy ByPass -File “My PowerShell
Script.ps1"
echo.
echo Is SQL Server Management Studio running and logged in to server ?
pause
echo.
echo Loading the SQL Query
“My SQL Script.sql"
marco kiesewettermarco kiesewetter
SIMPLE ETL
Your automated ETL solution is ready.
All you have to do now is saving the report results
under the same file name, run the batch script and
hit “Execute” in SQL Management Studio once it
loaded.
marco kiesewettermarco kiesewetter
THANKYOU
Questions?
Reach out:
https://www.linkedin.com/in/marcokiesewetter

More Related Content

What's hot

Mastering your Databases
Mastering your DatabasesMastering your Databases
Mastering your DatabasesSafe Software
 
To Loop or Not to Loop: Overcoming Roadblocks with FME
To Loop or Not to Loop: Overcoming Roadblocks with FMETo Loop or Not to Loop: Overcoming Roadblocks with FME
To Loop or Not to Loop: Overcoming Roadblocks with FMESafe Software
 
1Spatial: Cardiff FME World Tour: Getting started with FME
1Spatial: Cardiff FME World Tour: Getting started with FME1Spatial: Cardiff FME World Tour: Getting started with FME
1Spatial: Cardiff FME World Tour: Getting started with FME1Spatial
 
SAS Visual Process Flows
SAS Visual Process FlowsSAS Visual Process Flows
SAS Visual Process FlowsCraig Trim
 
Workspace Authoring 101: Feature Caching
Workspace Authoring 101: Feature CachingWorkspace Authoring 101: Feature Caching
Workspace Authoring 101: Feature CachingSafe Software
 
A Step-By-Step Guide to Building Codeless Web Apps
A Step-By-Step Guide to Building Codeless Web AppsA Step-By-Step Guide to Building Codeless Web Apps
A Step-By-Step Guide to Building Codeless Web AppsSafe Software
 
Testing in Infrastructure
Testing in InfrastructureTesting in Infrastructure
Testing in InfrastructureMuhammet Arslan
 
How to Develop for Data Transformation with FME Server
How to Develop for Data Transformation with FME ServerHow to Develop for Data Transformation with FME Server
How to Develop for Data Transformation with FME ServerSafe Software
 
What's New in DBArtisan and Rapid SQL 2016
What's New in DBArtisan and Rapid SQL 2016What's New in DBArtisan and Rapid SQL 2016
What's New in DBArtisan and Rapid SQL 2016Embarcadero Technologies
 
Mule – header collection
Mule – header collectionMule – header collection
Mule – header collectionD.Rajesh Kumar
 
Mule for each scope header collection
Mule for each scope   header collectionMule for each scope   header collection
Mule for each scope header collectionRam Bavireddi
 
Mule for each scope header collection
Mule for each scope header collectionMule for each scope header collection
Mule for each scope header collectionPraneethchampion
 

What's hot (14)

Mastering your Databases
Mastering your DatabasesMastering your Databases
Mastering your Databases
 
To Loop or Not to Loop: Overcoming Roadblocks with FME
To Loop or Not to Loop: Overcoming Roadblocks with FMETo Loop or Not to Loop: Overcoming Roadblocks with FME
To Loop or Not to Loop: Overcoming Roadblocks with FME
 
1Spatial: Cardiff FME World Tour: Getting started with FME
1Spatial: Cardiff FME World Tour: Getting started with FME1Spatial: Cardiff FME World Tour: Getting started with FME
1Spatial: Cardiff FME World Tour: Getting started with FME
 
SAS Visual Process Flows
SAS Visual Process FlowsSAS Visual Process Flows
SAS Visual Process Flows
 
Workspace Authoring 101: Feature Caching
Workspace Authoring 101: Feature CachingWorkspace Authoring 101: Feature Caching
Workspace Authoring 101: Feature Caching
 
Ajax
AjaxAjax
Ajax
 
A Step-By-Step Guide to Building Codeless Web Apps
A Step-By-Step Guide to Building Codeless Web AppsA Step-By-Step Guide to Building Codeless Web Apps
A Step-By-Step Guide to Building Codeless Web Apps
 
Testing in Infrastructure
Testing in InfrastructureTesting in Infrastructure
Testing in Infrastructure
 
How to Develop for Data Transformation with FME Server
How to Develop for Data Transformation with FME ServerHow to Develop for Data Transformation with FME Server
How to Develop for Data Transformation with FME Server
 
What's New in DBArtisan and Rapid SQL 2016
What's New in DBArtisan and Rapid SQL 2016What's New in DBArtisan and Rapid SQL 2016
What's New in DBArtisan and Rapid SQL 2016
 
Mule – header collection
Mule – header collectionMule – header collection
Mule – header collection
 
Aws setup
Aws setupAws setup
Aws setup
 
Mule for each scope header collection
Mule for each scope   header collectionMule for each scope   header collection
Mule for each scope header collection
 
Mule for each scope header collection
Mule for each scope header collectionMule for each scope header collection
Mule for each scope header collection
 

Similar to Simple ETL Solution - Marco Kiesewetter

Introduction to Threading in .Net
Introduction to Threading in .NetIntroduction to Threading in .Net
Introduction to Threading in .Netwebhostingguy
 
introductionofssis-130418034853-phpapp01.pptx
introductionofssis-130418034853-phpapp01.pptxintroductionofssis-130418034853-phpapp01.pptx
introductionofssis-130418034853-phpapp01.pptxYashaswiniSrinivasan1
 
SQL Server 2008 Integration Services
SQL Server 2008 Integration ServicesSQL Server 2008 Integration Services
SQL Server 2008 Integration ServicesEduardo Castro
 
Handling Database Deployments
Handling Database DeploymentsHandling Database Deployments
Handling Database DeploymentsMike Willbanks
 
TSQL in SQL Server 2012
TSQL in SQL Server 2012TSQL in SQL Server 2012
TSQL in SQL Server 2012Eduardo Castro
 
Sql 2016 - What's New
Sql 2016 - What's NewSql 2016 - What's New
Sql 2016 - What's Newdpcobb
 
My sql with querys
My sql with querysMy sql with querys
My sql with querysNIRMAL FELIX
 
Introduction of ssis
Introduction of ssisIntroduction of ssis
Introduction of ssisdeepakk073
 
New features of sql server 2005
New features of sql server 2005New features of sql server 2005
New features of sql server 2005Govind Raj
 
Oracle Database 12c - New Features for Developers and DBAs
Oracle Database 12c - New Features for Developers and DBAsOracle Database 12c - New Features for Developers and DBAs
Oracle Database 12c - New Features for Developers and DBAsAlex Zaballa
 
Oracle Database 12c - New Features for Developers and DBAs
Oracle Database 12c  - New Features for Developers and DBAsOracle Database 12c  - New Features for Developers and DBAs
Oracle Database 12c - New Features for Developers and DBAsAlex Zaballa
 
An overview of snowflake
An overview of snowflakeAn overview of snowflake
An overview of snowflakeSivakumar Ramar
 
Scanned by CamScannerModule 03 Lab WorksheetWeb Developmen.docx
Scanned by CamScannerModule 03 Lab WorksheetWeb Developmen.docxScanned by CamScannerModule 03 Lab WorksheetWeb Developmen.docx
Scanned by CamScannerModule 03 Lab WorksheetWeb Developmen.docxanhlodge
 
PostgreSQL Database Slides
PostgreSQL Database SlidesPostgreSQL Database Slides
PostgreSQL Database Slidesmetsarin
 

Similar to Simple ETL Solution - Marco Kiesewetter (20)

Introduction to Threading in .Net
Introduction to Threading in .NetIntroduction to Threading in .Net
Introduction to Threading in .Net
 
introductionofssis-130418034853-phpapp01.pptx
introductionofssis-130418034853-phpapp01.pptxintroductionofssis-130418034853-phpapp01.pptx
introductionofssis-130418034853-phpapp01.pptx
 
SQL Server 2008 Integration Services
SQL Server 2008 Integration ServicesSQL Server 2008 Integration Services
SQL Server 2008 Integration Services
 
Handling Database Deployments
Handling Database DeploymentsHandling Database Deployments
Handling Database Deployments
 
TSQL in SQL Server 2012
TSQL in SQL Server 2012TSQL in SQL Server 2012
TSQL in SQL Server 2012
 
Mysql
MysqlMysql
Mysql
 
Erik_van_Roon.pdf
Erik_van_Roon.pdfErik_van_Roon.pdf
Erik_van_Roon.pdf
 
Sql 2016 - What's New
Sql 2016 - What's NewSql 2016 - What's New
Sql 2016 - What's New
 
Sql saturday oc 2019
Sql saturday oc 2019Sql saturday oc 2019
Sql saturday oc 2019
 
My sql with querys
My sql with querysMy sql with querys
My sql with querys
 
Introduction of ssis
Introduction of ssisIntroduction of ssis
Introduction of ssis
 
New features of sql server 2005
New features of sql server 2005New features of sql server 2005
New features of sql server 2005
 
Oracle Database 12c - New Features for Developers and DBAs
Oracle Database 12c - New Features for Developers and DBAsOracle Database 12c - New Features for Developers and DBAs
Oracle Database 12c - New Features for Developers and DBAs
 
Oracle Database 12c - New Features for Developers and DBAs
Oracle Database 12c  - New Features for Developers and DBAsOracle Database 12c  - New Features for Developers and DBAs
Oracle Database 12c - New Features for Developers and DBAs
 
Sq lite
Sq liteSq lite
Sq lite
 
My sql.ppt
My sql.pptMy sql.ppt
My sql.ppt
 
An overview of snowflake
An overview of snowflakeAn overview of snowflake
An overview of snowflake
 
Scanned by CamScannerModule 03 Lab WorksheetWeb Developmen.docx
Scanned by CamScannerModule 03 Lab WorksheetWeb Developmen.docxScanned by CamScannerModule 03 Lab WorksheetWeb Developmen.docx
Scanned by CamScannerModule 03 Lab WorksheetWeb Developmen.docx
 
Sql tuning
Sql tuningSql tuning
Sql tuning
 
PostgreSQL Database Slides
PostgreSQL Database SlidesPostgreSQL Database Slides
PostgreSQL Database Slides
 

Recently uploaded

Call Girls In Radisson Blu Hotel New Delhi Paschim Vihar ❤️8860477959 Escorts...
Call Girls In Radisson Blu Hotel New Delhi Paschim Vihar ❤️8860477959 Escorts...Call Girls In Radisson Blu Hotel New Delhi Paschim Vihar ❤️8860477959 Escorts...
Call Girls In Radisson Blu Hotel New Delhi Paschim Vihar ❤️8860477959 Escorts...lizamodels9
 
VIP Kolkata Call Girl Howrah 👉 8250192130 Available With Room
VIP Kolkata Call Girl Howrah 👉 8250192130  Available With RoomVIP Kolkata Call Girl Howrah 👉 8250192130  Available With Room
VIP Kolkata Call Girl Howrah 👉 8250192130 Available With Roomdivyansh0kumar0
 
Call Girls In ⇛⇛Chhatarpur⇚⇚. Brings Offer Delhi Contact Us 8377877756
Call Girls In ⇛⇛Chhatarpur⇚⇚. Brings Offer Delhi Contact Us 8377877756Call Girls In ⇛⇛Chhatarpur⇚⇚. Brings Offer Delhi Contact Us 8377877756
Call Girls In ⇛⇛Chhatarpur⇚⇚. Brings Offer Delhi Contact Us 8377877756dollysharma2066
 
Catalogue ONG NUOC PPR DE NHAT .pdf
Catalogue ONG NUOC PPR DE NHAT      .pdfCatalogue ONG NUOC PPR DE NHAT      .pdf
Catalogue ONG NUOC PPR DE NHAT .pdfOrient Homes
 
VIP Call Girl Jamshedpur Aashi 8250192130 Independent Escort Service Jamshedpur
VIP Call Girl Jamshedpur Aashi 8250192130 Independent Escort Service JamshedpurVIP Call Girl Jamshedpur Aashi 8250192130 Independent Escort Service Jamshedpur
VIP Call Girl Jamshedpur Aashi 8250192130 Independent Escort Service JamshedpurSuhani Kapoor
 
RE Capital's Visionary Leadership under Newman Leech
RE Capital's Visionary Leadership under Newman LeechRE Capital's Visionary Leadership under Newman Leech
RE Capital's Visionary Leadership under Newman LeechNewman George Leech
 
2024 Numerator Consumer Study of Cannabis Usage
2024 Numerator Consumer Study of Cannabis Usage2024 Numerator Consumer Study of Cannabis Usage
2024 Numerator Consumer Study of Cannabis UsageNeil Kimberley
 
Call Girls Miyapur 7001305949 all area service COD available Any Time
Call Girls Miyapur 7001305949 all area service COD available Any TimeCall Girls Miyapur 7001305949 all area service COD available Any Time
Call Girls Miyapur 7001305949 all area service COD available Any Timedelhimodelshub1
 
Call Girls In Kishangarh Delhi ❤️8860477959 Good Looking Escorts In 24/7 Delh...
Call Girls In Kishangarh Delhi ❤️8860477959 Good Looking Escorts In 24/7 Delh...Call Girls In Kishangarh Delhi ❤️8860477959 Good Looking Escorts In 24/7 Delh...
Call Girls In Kishangarh Delhi ❤️8860477959 Good Looking Escorts In 24/7 Delh...lizamodels9
 
Tech Startup Growth Hacking 101 - Basics on Growth Marketing
Tech Startup Growth Hacking 101  - Basics on Growth MarketingTech Startup Growth Hacking 101  - Basics on Growth Marketing
Tech Startup Growth Hacking 101 - Basics on Growth MarketingShawn Pang
 
BEST Call Girls In Old Faridabad ✨ 9773824855 ✨ Escorts Service In Delhi Ncr,
BEST Call Girls In Old Faridabad ✨ 9773824855 ✨ Escorts Service In Delhi Ncr,BEST Call Girls In Old Faridabad ✨ 9773824855 ✨ Escorts Service In Delhi Ncr,
BEST Call Girls In Old Faridabad ✨ 9773824855 ✨ Escorts Service In Delhi Ncr,noida100girls
 
rishikeshgirls.in- Rishikesh call girl.pdf
rishikeshgirls.in- Rishikesh call girl.pdfrishikeshgirls.in- Rishikesh call girl.pdf
rishikeshgirls.in- Rishikesh call girl.pdfmuskan1121w
 
CATALOG cáp điện Goldcup (bảng giá) 1.4.2024.PDF
CATALOG cáp điện Goldcup (bảng giá) 1.4.2024.PDFCATALOG cáp điện Goldcup (bảng giá) 1.4.2024.PDF
CATALOG cáp điện Goldcup (bảng giá) 1.4.2024.PDFOrient Homes
 
Cash Payment 9602870969 Escort Service in Udaipur Call Girls
Cash Payment 9602870969 Escort Service in Udaipur Call GirlsCash Payment 9602870969 Escort Service in Udaipur Call Girls
Cash Payment 9602870969 Escort Service in Udaipur Call GirlsApsara Of India
 
Call Girls in DELHI Cantt, ( Call Me )-8377877756-Female Escort- In Delhi / Ncr
Call Girls in DELHI Cantt, ( Call Me )-8377877756-Female Escort- In Delhi / NcrCall Girls in DELHI Cantt, ( Call Me )-8377877756-Female Escort- In Delhi / Ncr
Call Girls in DELHI Cantt, ( Call Me )-8377877756-Female Escort- In Delhi / Ncrdollysharma2066
 
BEST Call Girls In BELLMONT HOTEL ✨ 9773824855 ✨ Escorts Service In Delhi Ncr,
BEST Call Girls In BELLMONT HOTEL ✨ 9773824855 ✨ Escorts Service In Delhi Ncr,BEST Call Girls In BELLMONT HOTEL ✨ 9773824855 ✨ Escorts Service In Delhi Ncr,
BEST Call Girls In BELLMONT HOTEL ✨ 9773824855 ✨ Escorts Service In Delhi Ncr,noida100girls
 
Lowrate Call Girls In Laxmi Nagar Delhi ❤️8860477959 Escorts 100% Genuine Ser...
Lowrate Call Girls In Laxmi Nagar Delhi ❤️8860477959 Escorts 100% Genuine Ser...Lowrate Call Girls In Laxmi Nagar Delhi ❤️8860477959 Escorts 100% Genuine Ser...
Lowrate Call Girls In Laxmi Nagar Delhi ❤️8860477959 Escorts 100% Genuine Ser...lizamodels9
 
Vip Female Escorts Noida 9711199171 Greater Noida Escorts Service
Vip Female Escorts Noida 9711199171 Greater Noida Escorts ServiceVip Female Escorts Noida 9711199171 Greater Noida Escorts Service
Vip Female Escorts Noida 9711199171 Greater Noida Escorts Serviceankitnayak356677
 

Recently uploaded (20)

Call Girls In Radisson Blu Hotel New Delhi Paschim Vihar ❤️8860477959 Escorts...
Call Girls In Radisson Blu Hotel New Delhi Paschim Vihar ❤️8860477959 Escorts...Call Girls In Radisson Blu Hotel New Delhi Paschim Vihar ❤️8860477959 Escorts...
Call Girls In Radisson Blu Hotel New Delhi Paschim Vihar ❤️8860477959 Escorts...
 
VIP Kolkata Call Girl Howrah 👉 8250192130 Available With Room
VIP Kolkata Call Girl Howrah 👉 8250192130  Available With RoomVIP Kolkata Call Girl Howrah 👉 8250192130  Available With Room
VIP Kolkata Call Girl Howrah 👉 8250192130 Available With Room
 
Call Girls In ⇛⇛Chhatarpur⇚⇚. Brings Offer Delhi Contact Us 8377877756
Call Girls In ⇛⇛Chhatarpur⇚⇚. Brings Offer Delhi Contact Us 8377877756Call Girls In ⇛⇛Chhatarpur⇚⇚. Brings Offer Delhi Contact Us 8377877756
Call Girls In ⇛⇛Chhatarpur⇚⇚. Brings Offer Delhi Contact Us 8377877756
 
Catalogue ONG NUOC PPR DE NHAT .pdf
Catalogue ONG NUOC PPR DE NHAT      .pdfCatalogue ONG NUOC PPR DE NHAT      .pdf
Catalogue ONG NUOC PPR DE NHAT .pdf
 
VIP Call Girl Jamshedpur Aashi 8250192130 Independent Escort Service Jamshedpur
VIP Call Girl Jamshedpur Aashi 8250192130 Independent Escort Service JamshedpurVIP Call Girl Jamshedpur Aashi 8250192130 Independent Escort Service Jamshedpur
VIP Call Girl Jamshedpur Aashi 8250192130 Independent Escort Service Jamshedpur
 
Best Practices for Implementing an External Recruiting Partnership
Best Practices for Implementing an External Recruiting PartnershipBest Practices for Implementing an External Recruiting Partnership
Best Practices for Implementing an External Recruiting Partnership
 
RE Capital's Visionary Leadership under Newman Leech
RE Capital's Visionary Leadership under Newman LeechRE Capital's Visionary Leadership under Newman Leech
RE Capital's Visionary Leadership under Newman Leech
 
2024 Numerator Consumer Study of Cannabis Usage
2024 Numerator Consumer Study of Cannabis Usage2024 Numerator Consumer Study of Cannabis Usage
2024 Numerator Consumer Study of Cannabis Usage
 
Call Girls Miyapur 7001305949 all area service COD available Any Time
Call Girls Miyapur 7001305949 all area service COD available Any TimeCall Girls Miyapur 7001305949 all area service COD available Any Time
Call Girls Miyapur 7001305949 all area service COD available Any Time
 
Call Girls In Kishangarh Delhi ❤️8860477959 Good Looking Escorts In 24/7 Delh...
Call Girls In Kishangarh Delhi ❤️8860477959 Good Looking Escorts In 24/7 Delh...Call Girls In Kishangarh Delhi ❤️8860477959 Good Looking Escorts In 24/7 Delh...
Call Girls In Kishangarh Delhi ❤️8860477959 Good Looking Escorts In 24/7 Delh...
 
KestrelPro Flyer Japan IT Week 2024 (English)
KestrelPro Flyer Japan IT Week 2024 (English)KestrelPro Flyer Japan IT Week 2024 (English)
KestrelPro Flyer Japan IT Week 2024 (English)
 
Tech Startup Growth Hacking 101 - Basics on Growth Marketing
Tech Startup Growth Hacking 101  - Basics on Growth MarketingTech Startup Growth Hacking 101  - Basics on Growth Marketing
Tech Startup Growth Hacking 101 - Basics on Growth Marketing
 
BEST Call Girls In Old Faridabad ✨ 9773824855 ✨ Escorts Service In Delhi Ncr,
BEST Call Girls In Old Faridabad ✨ 9773824855 ✨ Escorts Service In Delhi Ncr,BEST Call Girls In Old Faridabad ✨ 9773824855 ✨ Escorts Service In Delhi Ncr,
BEST Call Girls In Old Faridabad ✨ 9773824855 ✨ Escorts Service In Delhi Ncr,
 
rishikeshgirls.in- Rishikesh call girl.pdf
rishikeshgirls.in- Rishikesh call girl.pdfrishikeshgirls.in- Rishikesh call girl.pdf
rishikeshgirls.in- Rishikesh call girl.pdf
 
CATALOG cáp điện Goldcup (bảng giá) 1.4.2024.PDF
CATALOG cáp điện Goldcup (bảng giá) 1.4.2024.PDFCATALOG cáp điện Goldcup (bảng giá) 1.4.2024.PDF
CATALOG cáp điện Goldcup (bảng giá) 1.4.2024.PDF
 
Cash Payment 9602870969 Escort Service in Udaipur Call Girls
Cash Payment 9602870969 Escort Service in Udaipur Call GirlsCash Payment 9602870969 Escort Service in Udaipur Call Girls
Cash Payment 9602870969 Escort Service in Udaipur Call Girls
 
Call Girls in DELHI Cantt, ( Call Me )-8377877756-Female Escort- In Delhi / Ncr
Call Girls in DELHI Cantt, ( Call Me )-8377877756-Female Escort- In Delhi / NcrCall Girls in DELHI Cantt, ( Call Me )-8377877756-Female Escort- In Delhi / Ncr
Call Girls in DELHI Cantt, ( Call Me )-8377877756-Female Escort- In Delhi / Ncr
 
BEST Call Girls In BELLMONT HOTEL ✨ 9773824855 ✨ Escorts Service In Delhi Ncr,
BEST Call Girls In BELLMONT HOTEL ✨ 9773824855 ✨ Escorts Service In Delhi Ncr,BEST Call Girls In BELLMONT HOTEL ✨ 9773824855 ✨ Escorts Service In Delhi Ncr,
BEST Call Girls In BELLMONT HOTEL ✨ 9773824855 ✨ Escorts Service In Delhi Ncr,
 
Lowrate Call Girls In Laxmi Nagar Delhi ❤️8860477959 Escorts 100% Genuine Ser...
Lowrate Call Girls In Laxmi Nagar Delhi ❤️8860477959 Escorts 100% Genuine Ser...Lowrate Call Girls In Laxmi Nagar Delhi ❤️8860477959 Escorts 100% Genuine Ser...
Lowrate Call Girls In Laxmi Nagar Delhi ❤️8860477959 Escorts 100% Genuine Ser...
 
Vip Female Escorts Noida 9711199171 Greater Noida Escorts Service
Vip Female Escorts Noida 9711199171 Greater Noida Escorts ServiceVip Female Escorts Noida 9711199171 Greater Noida Escorts Service
Vip Female Escorts Noida 9711199171 Greater Noida Escorts Service
 

Simple ETL Solution - Marco Kiesewetter

  • 1. marco kiesewettermarco kiesewetter SIMPLE ETL SOLUTION Extracting,Transforming, Loading Data From Any System To SQL Server Right FromYour Desktop.
  • 2. marco kiesewettermarco kiesewetter OVERVIEW  Why use manual ETL from your desktop?  A common issue to deal with  Example: Salesforce to SQL - a simple way to load fresh data  Recap:What is ETL?  Extract data from outside source, i.e. Salesforce.com  Transform data to fit operational needs  Load data into a data storage system such as a SQL database, data mart or data warehouse
  • 3. marco kiesewettermarco kiesewetter WHY USE MANUAL ETL  Business Analysts, Financial Analysts and BI Developers run into two common situations where a manual desktop upload is needed:  The data does not yet exist in SQL  Often it is helpful to get a sample dataset into SQL to test and justify an new data source that is needed.  Development using this new data source can begin immediately, even before the automated ETL job is set up by your IT department  The data needs to be refreshed off-schedule  Many ETL jobs run once or twice a day. If an extra refresh is needed at times, a manual upload of ‘fresh’ data can be the quickest way
  • 4. marco kiesewettermarco kiesewetter A COMMON ISSUE TO DEAL WITH One of the most common issues is the formatting of the raw data  Field delimiters & row delimiters may not be standard  The use of quotations and commas in text fields can cause delimiter recognition to fail  SQL Server does only support CSV upload if the data is in a specific format  Salesforce row delimiters are not recognized  Quotes only work if all fields in a column are enclosed in quotes
  • 5. marco kiesewettermarco kiesewetter SALESFORCE TO SQL - A SIMPLE WAY TO LOAD FRESH DATA Example
  • 6. marco kiesewettermarco kiesewetter AUTOMATION & SIMPLICITY Requirement:  Automation – very little manual effort  Simplicity – anyone can run the update
  • 7. marco kiesewettermarco kiesewetter STEP 1: THE EXTRACT FILE Download the Salesforce report results you want to upload  Download as CSV  Save in an accessible network path  The SQL server has to be able to access it.  Use a filename that does not change  Avoid dates etc. in the file name.  Scripts will access this filename in this folder. For an update simply overwrite this file.
  • 8. marco kiesewettermarco kiesewetter STEP 2: STANDARDIZE THE FILE  Now we are usingWindows PowerShell to prepare the csv for upload  Often we will have commas in comments or other text fields.We should change the field delimiter to a different symbol.The pipe “|” is a good option.  First we will need change all existing pipes to something else in order to make the pipe symbol unique as field delimiter.  In the example below I simply remove the pipes by replacing them with an empty string, they can be replaced with anything else, though. # Define the file but note that I do not add “.csv” $csvfile = 'serverfoldersalesforceExtract' # Now we replace all pipes get-content ($csvfile + ".csv") | % {$_ -replace "|", ""} | out-file ($csvfile +" (no Pipes).csv") -force -encoding ascii
  • 9. marco kiesewettermarco kiesewetter STEP 2: STANDARDIZE THE FILE  Next we will change the delimiter and standardize the CSV file:  The file salesforceExtract (standardized).csv has now all fields in quotes. Since we do not use commas as delimiters and all pipes were removed from all text fields, we can safely remove all quotes from the file: # Make standard CSV but use Pipes as delimiter Import-csv -path ($csvfile + " (no Pipes).csv") -Delimiter ',' | Export-CSV -path ($csvfile + " (standardized).csv") - Delimiter '|' # Remove all Quotes (“) get-content ($csvfile + " (standardized).csv") | % { $_ - replace '"',""} | Set-Content ($csvfile + " (upload).csv")
  • 10. marco kiesewettermarco kiesewetter STEP 3: UPLOAD TO SQL  Finally, we upload this prepared CSV to SQL server using Microsoft SQL Server Management Studio  For this we use the BULK INSERT command  In most cases we may upload a complete new data set.The easiest way to handle this is by deleting the old table and re-creating it.  Another advantage for doing this is the ease with which new fields can be added or the variable types of fields can be changed.The new creation of the table allows for any such adjustments.  Note that the BULK INSERT functionality is a server-side permission setting and may need to be activated for your login.
  • 11. marco kiesewettermarco kiesewetter STEP 3: UPLOAD TO SQL  Here is an example SQL script you can adjust to fit your needs: use YourDB drop table [dbo].[YourTable] go create table [dbo].[YourTable]( Field1 nVARCHAR(255) null, Field2 datetime null, Field3 float null, go bulk insert YourTable from 'serverfoldersalesfoceExtract (upload).csv' With ( fieldterminator = '|', rowterminator = 'n', firstrow = 2 ) go
  • 12. marco kiesewettermarco kiesewetter STEP 4: PUTTING IT ALLTOGETHER  Put all the PowerShell commands into a text file with the extension .ps1  Put the SQL script into a text file with the extension .sql  Now create a batch script (example below, file extension .bat) that runs all of the above commands and place everything in the same folder in which you save your extracted CSV from Salesforce @echo off cls echo Standardizing the CSV file... powershell.exe -noprofile -ExecutionPolicy ByPass -File “My PowerShell Script.ps1" echo. echo Is SQL Server Management Studio running and logged in to server ? pause echo. echo Loading the SQL Query “My SQL Script.sql"
  • 13. marco kiesewettermarco kiesewetter SIMPLE ETL Your automated ETL solution is ready. All you have to do now is saving the report results under the same file name, run the batch script and hit “Execute” in SQL Management Studio once it loaded.
  • 14. marco kiesewettermarco kiesewetter THANKYOU Questions? Reach out: https://www.linkedin.com/in/marcokiesewetter