• No results found

SQL Server Integration Services Design Patterns

N/A
N/A
Protected

Academic year: 2021

Share "SQL Server Integration Services Design Patterns"

Copied!
11
0
0

Loading.... (view fulltext now)

Full text

(1)

SQL

Server

Integration

Services

Design

Patterns

Second Edition

Andy

Leonard

Tim Mitchell

Matt

Masson

Jessica Moss

Michelle Ufford

Apress*

(2)

Contents

J

First-Edition Foreword xv

About the Authors xvii

About theTechnical Reviewer xix

Chapter

1: Metadata Collection 1

About SQL Server Data Tools 1

A Peek at the Final Product 1

SQLServer

Metadatacatalog

3 sys.dm_os_performance_counters 3 sys.dm_db_index__usage_stats 3 sys.dm_os_sys_info 3 sys.tables 3 sys.indexes 3 sys.partitions 4 sys.allocation_units 4

Setting Up

the Central

Repository

4

The Iterative Framework 6

Metadata Collection 14

Summary

26

HChapter

2:Execution Patterns 27

Building

the Demonstration SSIS

Package

27

DebugExecution 28

Command-LineExecution 29

ExecutePackage Utility 30

(3)

TheSQLServer 2014

Integration

Services Service 30 IntegrationServicesCatalogs 30

IntegrationServerCatalogStored Procedures 31

Scheduling

SSIS

Package

Execution 53 SchedulinganSSIS Package 53 SchedulingaFileSystem Package 54

RunningSQLServerAgentJobs with the Custom Execution Framework 55

Runningthe Custom ExecutionFrameworkwith SQL ServerAgent 56 ExecutePackageTask 57

Execution from

Managed

Code 58

The DemoApplication 58

ThefrmMain Form 59

Conclusion 70

^Chapter

3:

Scripting

Patterns 71

The Toolset 71

Should IUseScript? 72

TheScriptEditor 72

TheScriptTask 75

TheScript Component 77

Script

Maintenance Patterns 78

Code Reuse 78

Source Control 79

Scripting Design

Patterns 79

ConnectionManagersandScripting 80

Variables 82

NamingPatterns 85

(4)

CONTENTS

Chapter

4:SQLServer Source Patterns 87

Setting Up

a Source 87

Selecting

aSQL Server Connection

Manager

and Provider 88

ADO.NET 89

ODBC 89

OLE DB 91

Creating

aSQL Server Source

Component

92

Writing

a SQL Server Source

Component Query

95

ADO.NETData Access 95

OLE DB Data Access 96

WasteNot,Want Not 97

Data Translations 97

Source Assistant 97

Summary

99

Chapter

5: Data Correction with Data

Quality

Services 101

OverviewofData

Quality

Services 101 Usingthe DataQualityClient 102

Using

DQS withSSIS 108

DQSCleansingTransform 108

DQS ExtensionsonCodePlex 113

Cleansing

Data in the Data Flow 114 HandlingtheOutputof theDQS CleansingTransform 114

Performance Considerations 117

Approving

and

Importing

Cleansing

Rules 121

Conclusion 123

^Chapter

6: DB2 Source Patterns 125 DB2 Database

Family

125

Selecting

a DB2 Provider 126

Find theDatabase Version 126

Pick ProviderVendor 127

(5)

Connecting

to aDB2 Database 127

Querying

the DB2 Database 130

DB2 SourceComponentParameters 131

DB2 SourceComponent DynamicQueries 132

Summary

133

Chapter

7: Flat File Source Patterns ...135

Flat File Sources 135 Movingto SSIS! 136

Strong-Typingthe Data 138

IntroducingaData-Staging Pattern 140

Variable-Length

Rows 143

Readingintoa Data Flow 144

Splitting RecordTypes 145

Terminatingthe Streams 146

Header and Footer Rows 147 ConsumingaFooter Row 148

ConsumingaHeader Row 150

Producing aFooter Row 152

Producing aHeaderRow 159

The Archive File Pattern 163

Summary

169

Chapter

8:

Loading

a PDW

Region

in APS 171

Massively

Parallel

Processing

171

APS

Appliance

Overview 172

Hardware Architecture 172

Software Architecture 173

Shared-NothingArchitecture 175

Clustered Columnstore Indexes 175

(6)

CONTENTS

Loading

Data 176

DWLoadervs.IntegrationServices 176

ETLvs. ELT 177

Data

Import

Pattern for PDW 178

Prerequisites 178

Preparingthe Data 179

PackageOverview 181

The Data Source 181

The Data Transformation 183

The DataDestination 184

Multithreading 189

Limitations 190

Summary

191

Chapter

9:XML Patterns 193

Using

the XML Source 193

DealingwithMultiple Outputs 194

MakingThingsEasier with XSLT 200

Using

a

Script Component

203

ConfiguringtheScript Component 203 ProcessingXML with XmlSerializer 209

ProcessingXMLwith XmlReader and LINQ to XML 210

Conclusion 212

Chapter

10:

Expression Language

Patterns 213

Getting

to Know the

Expression Language

213

WhatIs the Expression Language? 213

WhyUse Expressions? 214

LanguageEssentials 215

Limitations 215

(7)

Putting

the

Expression

Language

to Work 216

Package Expressions 216

VariableExpressions 217

ConnectionManagers 217

Project-LevelConnectionManagers 219

Control Flow 219

Data Flow Expressions 222

Conclusion 226

aChapter

11: Data Warehouse Patterns • 227

Incremental Loads 227

WhatIsanIncrementalLoad? 227

Why Incremental Loads? 228

TheSlowly Changing Dimension 228 Incremental Loads of Fact Data 228

Incremental Loads in SSIS 228

Native SSISComponents 229

TheSlowly

Changing

Dimension Wizard 232

TheMERGE Statement 234

Change DataCapture (CDC) 237

DataErrors 242

SimpleErrors 242

MissingData 243

Codingto Allow Errors 246

Data Warehouse ETLWorkflow 248 Dividing Upthe Work 248 OnePackage=One Unit of Work 249

Conclusion 250

(8)

CONTENTS

Chapter

12: OData Source -251

Understanding

the OData Protocol 251

DataType Mappings 252

Query Options 253

Configuring

the OData Connection

Manager

254

Enabling

Microsoft Online ServicesAuthentication 254

Configuring

the Source

Component

256

Overriding

Data

Types

259

Conclusion 260

a*

Chapter

13:

Slowly Changing

Dimensions 261 The

Slowly

Changing

Dimension Transform 261

Runningthe Wizard 262

Usingthe Transformations 267

OptimizingPerformance 268

Third-Party

SCD

Components

269

Merge

Pattern 270

Handling Type 1 Changes 271

Handling Type2Changes 272

Conclusion 272

HChapter

14:

Loading

the Cloud 275

Interacting

with the Cloud 275

Incremental Loads to Azure SQL Database 276

ChangeDetection 276

New Rows(Only) 276

Building

the Cloud Loader 277

Conclusion 280

(9)

Chapter

15:

Logging

and

Reporting

Patterns 281

Package

Logging

and

Reporting

281

Setting Up PackageLogging 281 ReportingonPackage Logging 282

DesignPattern:PackageExecutions 283

Catalog Logging

and

Reporting

283

Setting UpCatalog Logging 283 CatalogTables 285

ChangingLoggingLevels After the Fact 286

Design

Patterns 287

ChangingtheLoggingLevel 287

UsingtheExistingReports 289 CreatingNewReports 290

Summary

291

Chapter

16: Parent-Child Patterns 293 Master

Package

Pattern 293 AssigntheChildPackage 294 ConfigureParameterBinding 295

Dynamic

Child

Package

Pattern 296

Child-to-Parent Variable Pattern 302

Conclusion 303

Chapter

17:

Configuration

305

Parameters 305

ConfiguringYourPackageUsingParameters 307

Usingthe Parametrize Dialog 309

CreatingVisual StudioConfigurations 310

SpecifyingEntry-PointPackages 312

Connection

Managers

313

(10)

CONTENTS

Parameter

Configuration

onthe Server 313 DefaultConfiguration 314

Server Environments 315

DefaultParameterValuesUsingT-SQL 317

Package ExecutionThroughthe SSISCatalog 317

Parameterswith DTEXEC 320

Projectsonthe FileSystem 320

Projectsin the SSISCatalog 321

Dynamic Configurations

322

ConfiguringfromaDatabase Table 323

SettingValuesUsingaScriptTask 326

DynamicPackageExecutions 327

Conclusion 329

Chapter

18:

Deployment

331

Project Deployment

Model 331

SSIS

Catalog

332

Deployment

Methods 334

DeploymentfromtheCommandLine 335

Deployment Using Custom Code 336

Deployment UsingPowerShell 337

Deployment UsingSQL 338

Package

Deployment

Model 339

Conclusion 341

Chapter

19: Business

Intelligence Markup Language

343 A Brief

History

of Business

Intelligence

Markup Language

343

Building

Your First Biml File 344

Building

aBasic Incremental Load SSIS

Package

347

CreatingDatabasesandTables 347

Adding Metadata 349

(11)

SpecifyingaData Flow Task 350

AddingTransforms 350

Testingthe Biml 356

Using

Bimlas an SSIS

Design

Patterns

Engine

360

Time for aTest 367

Conclusion 368

HChapter

20: Biml andSSIS Frameworks 369

Using

Biml with an SSIS Framework 369

AddingSSISPackageMetadatato theFramework 369

Executingthe Biml File 374

Generating

the SSIS Command-Line 375

Summarizing

376

£9Appendix

A: Evolution ofan SSIS Framework 377

Starting

in the Middle 377

IntroducingSSISApplications 387

A Note AboutRelationships 389

RetrievingSSISApplicationsinT-SQL 392

RetrievingSSISApplicationsin SSIS 396

Monitoring

Execution 399

Building ApplicationInstanceLogging 399

Building Package Instance Logging 406

BuildingErrorLogging 410

Reporting

Execution Metrics 420

Conclusion 434

Index 435

References

Related documents

NO.8 You are developing a SQL Server Integration Services (SSIS) package to load data into a data warehouse.. The package consists of several data

to look young for one’s years aparentar joven para la edad de uno.. to be getting on in years entrar

“En Veracruz aún se cultiva la composición de coplas de diez versos (o décimas), que también estuvieron arraigadas en otras partes de Latinoamérica. En este

(d) Unless otherwise agreed by the parties, the arbitral tribunal may, at the request of a party, order any party to take such interim measures of protection as the

*Note that the highest power of an unknown of a quadratic equation is 2... *Note that the highest power of an unknown of a quadratic function

With mastermind high desk and temptation high desk, Sedus is offering two separate ranges that combine all the advantages of modern high- desk concepts.. Whether for

Yet conscious movement is not simply a practice good for your health, but an application of Islamic Meditation that will accelerate your spiritual growth

Th e ability of black pepper to make drugs more bioavailable may be the main reason why an herbal mixture called trikatu is so widely prescribed along with other treatments