0% found this document useful (0 votes)
7K views

Download Full Data Engineering with dbt: A practical guide to building a cloud-based, pragmatic, and dependable data platform with SQL Zagni PDF All Chapters

dependable

Uploaded by

heighziebaii
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7K views

Download Full Data Engineering with dbt: A practical guide to building a cloud-based, pragmatic, and dependable data platform with SQL Zagni PDF All Chapters

dependable

Uploaded by

heighziebaii
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 41

Download the Full Version of ebook for Fast Typing at ebookmass.

com

Data Engineering with dbt: A practical guide to


building a cloud-based, pragmatic, and dependable
data platform with SQL Zagni

https://ebookmass.com/product/data-engineering-with-dbt-a-
practical-guide-to-building-a-cloud-based-pragmatic-and-
dependable-data-platform-with-sql-zagni/

OR CLICK BUTTON

DOWNLOAD NOW

Download More ebook Instantly Today - Get Yours Now at ebookmass.com


Recommended digital products (PDF, EPUB, MOBI) that
you can download immediately if you are interested.

Getting Started with SQL and Databases: Managing and


Manipulating Data with SQL Mark Simon

https://ebookmass.com/product/getting-started-with-sql-and-databases-
managing-and-manipulating-data-with-sql-mark-simon/

ebookmass.com

Getting Started with SQL and Databases: Managing and


Manipulating Data with SQL 1st Edition Mark Simon

https://ebookmass.com/product/getting-started-with-sql-and-databases-
managing-and-manipulating-data-with-sql-1st-edition-mark-simon/

ebookmass.com

Security Engineering: A Guide to Building Dependable


Distributed Systems 3° Edition Ross Anderson

https://ebookmass.com/product/security-engineering-a-guide-to-
building-dependable-distributed-systems-3-edition-ross-anderson/

ebookmass.com

Data Engineering with AWS: Acquire the skills to design


and build AWS-based data transformation pipelines like a
pro 2nd Edition Eagar
https://ebookmass.com/product/data-engineering-with-aws-acquire-the-
skills-to-design-and-build-aws-based-data-transformation-pipelines-
like-a-pro-2nd-edition-eagar/
ebookmass.com
Data Ingestion with Python Cookbook: A practical guide to
ingesting, monitoring, and identifying errors in the data
ingestion process 1st Edition Esppenchutz
https://ebookmass.com/product/data-ingestion-with-python-cookbook-a-
practical-guide-to-ingesting-monitoring-and-identifying-errors-in-the-
data-ingestion-process-1st-edition-esppenchutz/
ebookmass.com

Hands On With Google Data Studio: A Data Citizen's


Survival Guide Lee Hurst

https://ebookmass.com/product/hands-on-with-google-data-studio-a-data-
citizens-survival-guide-lee-hurst/

ebookmass.com

Google Cloud Platform for Data Science: A Crash Course on


Big Data, Machine Learning, and Data Analytics Services
Dr. Shitalkumar R. Sukhdeve
https://ebookmass.com/product/google-cloud-platform-for-data-science-
a-crash-course-on-big-data-machine-learning-and-data-analytics-
services-dr-shitalkumar-r-sukhdeve/
ebookmass.com

Data Science With Rust: A Comprehensive Guide - Data


Analysis, Machine Learning, Data Visualization & More Van
Der Post
https://ebookmass.com/product/data-science-with-rust-a-comprehensive-
guide-data-analysis-machine-learning-data-visualization-more-van-der-
post/
ebookmass.com

Unlocking dbt : Design and Deploy Transformations in Your


Cloud Data Warehouse Cameron Cyr

https://ebookmass.com/product/unlocking-dbt-design-and-deploy-
transformations-in-your-cloud-data-warehouse-cameron-cyr/

ebookmass.com
Data Engineering with dbt

A practical guide to building a cloud-based, pragmatic, and


dependable data platform with SQL

Roberto Zagni

BIRMINGHAM—MUMBAI
Data Engineering with dbt
Copyright © 2023 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted
in any form or by any means, without the prior written permission of the publisher, except in the case
of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information
presented. However, the information contained in this book is sold without warranty, either express
or implied. Neither the author, nor Packt Publishing or its dealers and distributors, will be held liable
for any damages caused or alleged to have been caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and
products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot
guarantee the accuracy of this information.

Publishing Product Manager: Reshma Raman


Content Development Editor: Joseph Sunil
Technical Editor: Kavyashree KS
Copy Editor: Safis Editing
Project Coordinator: Farheen Fathima
Proofreader: Safis Editing
Indexer: Hemangini Bari
Production Designer: Aparna Bhagat
Marketing Coordinator: Shifa Ansari

First published: June 2023


Production reference: 1300623

Published by Packt Publishing Ltd.


Livery Place
35 Livery Street
Birmingham
B3 2PB, UK.

ISBN 978-1-80324-628-4
www.packtpub.com
To the four females in my daily life: my wife, who supports me every day, my daughters,
who keep me grounded in reality, and our dog Lily for the sparkles of love and happiness
that she spreads around every day.
To my mother and my late father who through their sacrifices and support allowed me
to become what I wanted to be.

I love you all.

– Roberto Zagni
Contributors

About the author


Roberto Zagni is a senior leader with extensive hands-on experience in data architecture, software
development, and agile methodologies. Roberto is an electronic engineer by training with a special
interest in bringing software engineering best practices to cloud data platforms and growing great
teams that enjoy what they do. He has been helping companies to better use their data, and now to
transition to cloud-based data automation with an agile mindset and proper software engineering
tools and processes, such as DataOps. Roberto also provides hands-on coaching to data teams on
practical data architecture and the use of patterns, testing, version control, and agile collaboration.
Since 2019, his go-to tools have been dbt, dbt Cloud, and Snowflake or BigQuery.

I would like to thank my customers and colleagues for all the problems, and discussions to get to a
working solution that helped me to become a better software and data engineer and collect a wide
array of experiences in software and data engineering.
This book is my little contribution to the data engineering community.

I hope that I have been able to put the core set of knowledge that I would have loved to have in my
days as a data engineer in one place, along with a simple, opinionated way to build data platforms
using the modern data stack and proven patterns that scale and simplify everyday work.
About the reviewers
Hari Krishnan has been in the data space for close to 20 years now. He started at Infosys Limited,
working on mainframe technology for about 6 years, and then moved over to Informatica, then
eventually into business intelligence, big data, and the cloud in general. Currently, he is senior manager
of data engineering at Beachbody LLC, where he manages a team of data engineers with Airflow, dbt,
and Snowflake as the ir primary tech stack. He built the data lake and migrated the data warehouse
as well the ETL/ELT pipelines from on-premises to the cloud. He spent close to 13 years working for
Infosys and has spent the last 7 years with Beachbody. He is a technology enthusiast and always has
an appetite to discover, explore, and innovate new avenues in the data space.

Daniel Joshua Jayaraj S R is a data evangelist and business intelligence engineer, with over six years of
experience in the field of data analytics, data modeling, and visualization. He has helped organizations
understand the full potential of their data by providing stakeholders with strong business-oriented
visuals, thereby enhancing data-driven decisions. He has worked with multiple tools and technologies
during his career and completed his master’s in big data and business analytics.
I would like to thank my mother, S J Inbarani, who has been my motivation my whole life. I would also
like to thank Roberto Zagni for allowing me to review this wonderful book on dbt.
Table of Contents
Prefacexv

Part 1: The Foundations of Data Engineering


1
The Basics of SQL to Transform Data 3
Technical requirements 4 and operators 22
Introducing SQL 4 Snowflake query syntax 22
SQL basics – core concepts and SQL operators 36
commands5 Combining data in SQL – the JOIN
SQL core concepts 5 clause39
Understanding the categories of SQL Combining orders and customers 40
commands10 JOIN types 41
Setting up a Snowflake database with Visual representation of join types 43
users and roles 14 Advanced – introducing window
Creating your Snowflake account 14 functions47
Setting up initial users, roles, and a database Window definition 48
in Snowflake 17
Window frame definition 49
Creating and granting your first role 19
Summary51
Querying data in SQL – syntax
Further reading 51

2
Setting Up Your dbt Cloud Development Environment 53
Technical requirements 54 Creating your GitHub account 56
Setting up your GitHub account 54
Introducing Version Control 54
viii Table of Contents

Setting up your first repository for dbt 61 Experimenting with SQL in dbt Cloud 91
Exploring the dbt Cloud IDE 92
Setting up your dbt Cloud account 63
Executing SQL from the dbt IDE 93
Signing up for a dbt Cloud account 63
Setting up your first dbt Cloud project 65 Introducing the source and ref dbt
Adding the default project to an empty functions94
repository80 Exploring the dbt default model 95
Comparing dbt Core and dbt Cloud Using ref and source to connect models 97
workflows85 Running your first models 98
Testing your first models 100
dbt Core workflows 85
Editing your first model 101
dbt Cloud workflows 88
Summary103
Further reading 103

3
Data Modeling for Data Engineering 105
Technical requirements 106 Modeling use cases and patterns 124
What is and why do we need data Header-detail use case 124
modeling?106 Hierarchical relationships 126
Understanding data 106 Forecasts and actuals 131
What is data modeling? 106 Libraries of standard data models 132
Why we need data modeling 107 Common problems in data models 132
Complementing a visual data model 109
Fan trap 133
Conceptual, logical, and physical Chasm trap 135
data models 109
Modeling styles and architectures 137
Conceptual data model 110
Kimball method or dimensional modeling or
Logical data model 111 star schema 138
Physical data model 113 Unified Star Schema 141
Tools to draw data models 114 Inmon design style 144
Entity-Relationship modeling 114 Data Vault 145
Main notation 114 Data mesh 148
Cardinality115 Our approach, the Pragmatic Data
Time perspective 120 Platform - PDP 150
An example of an E-R model at different Summary151
levels of detail 122
Further reading 151
Generalization and specialization 122
Table of Contents ix

4
Analytics Engineering as the New Core of Data Engineering 153
Technical requirements 154 Defining analytics engineering 168
The data life cycle and its evolution 154 The roles in the modern data stack 169
Understanding the data flow 154 The analytics engineer 169
Data creation 155 DataOps – software engineering best
Data movement and storage 156 practices for data 170
Data transformation 162
Version control 171
Business reporting 164
Quality assurance 171
Feeding back to the source systems 165
The modularity of the code base 172
Understanding the modern Development environments 173
data stack 166 Designing for maintainability 174
The traditional data stack 166 Summary176
The modern data stack 167
Further reading 176

5
Transforming Data with dbt 177
Technical requirements 177 How to write and test
The dbt Core workflow for ingesting transformations198
and transforming data 178 Writing the first dbt model 198
Introducing our stock tracking Real-time lineage and project navigation 200
project181 Deploying the first dbt model 200
The initial data model and glossary 181 Committing the first dbt model 201
Setting up the project in dbt, Snowflake, Configuring our project and where we
and GitHub 183 store data 202
Re-deploying our environment to the
Defining data sources and providing desired schema 204
reference data 187 Configuring the layers for our architecture 207
Defining data sources in dbt 187 Ensuring data quality with tests 209
Loading the first data for the portfolio project 192 Generating the documentation 217

Summary219
x Table of Contents

Part 2: Agile Data Engineering with dbt


6
Writing Maintainable Code 223
Technical requirements 224 Goals and contents of the refined layer 241
Writing code for humans 224 Creating the first data mart 245

Refactoring our initial model to be Saving history is crucial 246


human-readable225 Saving history with dbt 248
Creating the architectural layers 226 Saving history using snapshots 249
Creating the Staging layer 227 Connecting the REF layer with the snapshot 255
Goals and contents of the staging models 231 Summary257
Connecting the REF model to the STG 240

7
Working with Dimensional Data 259
Adding dimensional data 260 Creating an STG model for the security
Creating clear data models for the refined dimension267
and data mart layers 260 Adding the default record to the STG 269

Loading the data of the first Saving history for the dimensional
dimension262 data269
Creating and loading a CSV as a seed 262 Saving the history with a snapshot 270
Configuring the seeds and loading them 263 Building the REF layer with the
Adding data types and a load timestamp dimensional data 271
to your seed 263
Adding the dimensional data to the
Building the STG model for the first data mart 272
dimension266 Exercise – adding a few more
Defining the external data source for seeds 266 hand-maintained dimensions 273
Summary274
Table of Contents xi

8
Delivering Consistency in Your Data 275
Technical requirements 275 Building on the shoulders of
Keeping consistency by reusing code giants – dbt packages 290
– macros 276 Creating dbt packages 291
Repetition is inherent in data projects 276 How to import a package in dbt 292
Why copy and paste kills your future self 277 Browsing through noteworthy packages
How to write a macro 277 for dbt 296
Refactoring the “current” CTE into a macro 278 Adding the dbt-utils package to our project 299
Fixing data loaded from our CSV file 282 Summary302
The basics of macro writing 284

9
Delivering Reliability in Your Data 303
Testing to provide reliability 303 Testing the right things in the right
Types of tests 304 places313
Singular tests 304 What do we test? 314
Generic tests 305 Where to test what? 316
Defining a generic test 308 Testing our models to ensure good quality 319

Summary329

10
Agile Development 331
Technical requirements 331 Organizing work the agile way 336
Agile development and collaboration 331 Managing the backlog in an agile way 337

Defining agile development 332 Building reports in an agile way 340


Applying agile to data engineering 333 S1 – designing a light data model for the
data mart 341
Starting a project in an agile way 334
S2 – designing a light data model for
the REF layer 350
xii Table of Contents

S3.x – developing with dbt models the S5 – development and verification of the
pipeline for the XYZ table 354 report in the BI application 357
S4 – an acceptance test of the data produced
Summary357
in the data mart 356

11
Team Collaboration 359
Enabling collaboration 359 Keeping your development environment
Core collaboration practices 360 healthy368
Collaboration with dbt Cloud 361 Suggested Git branch naming 369
Adopting frequent releases 371
Working with branches and PRs 363
Making your first PR 372
Working with Git in dbt Cloud 364
The dbt Cloud Git process 364
Summary377
Further reading 377

Part 3: Hands-On Best Practices for Simple,


Future-Proof Data Platforms
12
Deployment, Execution, and Documentation Automation 381
Technical requirements 381 Advanced automation – hooks and
Designing your deployment run-operations408
automation382 Hooks408
Working with dbt environments 382 Run-operations410
Creating our QA and PROD environments 383 Table migrations 411
Deciding where to deploy 389 Documentation414
Creating jobs 390
Lineage graph 415
Designing the architecture of your data
dbt-generated documentation 416
platform405
Source freshness report 419
Notifications406
Exposures422
Markdown documentation 425

Summary426
Table of Contents xiii

13
Moving Beyond the Basics 427
Technical requirements 427 Main uses of keys 440
Building for modularity 428 Master Data management 440
Modularity in the storage layer 429 Data for Master Data management 441
Modularity in the refined layer 431 A light MDM approach with DBT 442
Modularity in the delivery layer 434
Saving history at scale 445
Managing identity 436 Understanding the save_history macro 447
Identity and semantics – defining Understanding the current_from_history
your concepts 436 macro455
Different types of keys 437
Summary458

14
Enhancing Software Quality 459
Technical requirements 459 Calculating transactions 482
Refactoring and evolving models 460 Publishing dependable datasets 484
Dealing with technical debt 460 Managing data marts like APIs 485
Implementing real-world code and What shape should you use for your
business rules 462 data mart? 485
Self-completing dimensions 487
Replacing snapshots with HIST tables 463
History in reports – that is, slowly changing
Renaming the REF_ABC_BANK_
dimensions type two 492
SECURITY_INFO model 466
Handling orphans in facts 468 Summary493
Calculating closed positions 473 Further reading 493

15
Patterns for Frequent Use Cases 495
Technical requirements 495 Loading data from files 501
Ingestion patterns 495 External tables 505
Landing tables 507
Basic setup for ingestion 498
xiv Table of Contents

History patterns 518 Storing history with PII and GDPR


Storing history with deletions – full load 519 compliance533
Storing history with deletion – deletion list 522 History and schema evolution 536
Storing history with multiple versions in Summary537
the input 527
Further reading 538

Index539

Other Books You May Enjoy 554


Discovering Diverse Content Through
Random Scribd Documents
Gaols, 59-61
Germans, 23, 27, 102, 146
Girl Students, 35, 50, 161-74, 180-4, 193, 208, 212
Goitre, 78
Government, Chinese, 25, 50, 61, 62, 81, 154, 211, 221
Governors, 58, 59, 106, 145, 171, 190-2, 200
Grand Canal, 35
Guilds, 178, 206
Gymnasium, 209

Haiphong, 36
Hakka, 13
Hangchow, 31-6
Hankow, 41-4
Han River, 43, 215
Hart, Sir Robert, 92
Helena May Institute, 36
Henry, Dr. Augustine, 125-35
Heyworth, Dr., 185, 212
Home for Incurables, 34
Honan, 171
Hong Kiang, 145
Hong Kong, 36, 197, 216-7
Hosie, Sir A., 40, 88
Hospitals, American, 146, 151-2
Anshunfu, 97
Changsha (Yale), 152
Chao Chowfu, 214
French (Yünnanfu), 70
Hangchow, 32-4
Peking, 22
Swatow, 212
Taiyuanfu, 62
Tsinan, 25-6
Wênchowfu, 205
Yünnanfu (C.M.S.), 70
Hotels:
Amichow, 38;
Amoy, 213;
Canton, 218;
Foochow, 213;
Hangchow, 35;
Lao Kay, 37;
Swatow, 213;
Yünnanfu, 39
Hunan, Ch. VI, 41, 42
Hupeh, 43
Hygiene, 26

I-chia or Lolos, 125, 127-135


Indo-China, 36
Industrial Life, 22, 23
Institute, Soldiers’, 24
International Life, 66

Japan, 23, 59, 154, 191-3, 218, 220


Japanese boycott, 183, 208
Education, 50, 59
Japanese Steamers, 42
Jordan, Sir John, 37, 51, 106
Jowett, Benjamin, 48

Kahn, Dr. Ida, 185


Kalachin, Princess, 185
Keh-lao Tribe, 97
Keller, Dr., 73, 152-3
Kuan Tzu Yao, 91
Ku-Chin, 72
Küticul, 79
Kütsingfu, 40
Kwangsi Province, 41, 171
Kwantung Province, 171
Kweichow Province, Ch. IV, 40, 41, 83
Kwei Yang, 41, 104-8

Lacquer, 98, 209


“La Jeunesse,” 194
Lang-Tai-Fung, 95
Language, 55, 56
Lolo, 127-9
Miao, 120-1
Lan-ni-Kou, 104
Lao-Kay, 37
League of Nations, 190
Leper Hospital, 33, 34
Li Ching Chien, Miss, 71
Lingle, Mr. and Mrs., 150
Locke, Mr. and Mrs., 149
Loess, 62
Logan, Mr. and Mrs., 165
Lolo, 124-137
Lo-yung-kio bridge, 35
Lugard, Sir F., 197

Macao, 217
Main, Dr. and Mrs., 31
Malong, 40, 79
Mandarin Chinese, 24, 57
Maternity Hospital, 32, 33
Medicine, Schools of, 22, 24, 33
Mencius, 16
Mettle, 17, 164
Military Escort, 76, 107-11
Minerals, 42, 75, 89
Missions, Baptist, 25, 152, 214-5
C.I.M. (China Inland Mission), 97, 105, 143, 146, 149, 206
C.M.S. (Church Missionary Society), 34, 70, 179, 208
Danish, 153
English United Methodist, 206
L.M.S. (London Missionary Society), 153
Norwegian, 153
Presbyterian (Eng. & Amer.), 149, 210-6
Russian, 153
Wesleyan, 154, 163
Mixed Courts, 28
Mohammedans, 27
Money, 36, 38, 39, 40, 222
Mongtsze, 38
Morals, 117, 120
Morrison, Dr., 88
Mott, Dr., 163
Music, 54, 135, 208

Nanking, 24, 44
National Language, 56
Nestorians, 132
New York, 199
North and South, Division of, 37
troops, 150, 154-5, 159, 160, 170
Norton, Mr. and Mrs., 209
Nurses, 33, 212

“On the Trail of the Opium Poppy,” 40, 88


Open ports, 28, 43-4, 160, 218
Opium, 70, 72, 76, 79, 80-1, 105-6, 127, 160-1, 170, 218
Otterwell, Mr., 39
“Outward Bound,” 49, 201

Pagoda Anchorage, 207


Partington, T. Bowen, 206
“Passionate Pilgrim,” 188
Peking, 17, 18, 20-3, 71, 92
Peng-I-Hu, 194
Physical Culture, 51, 167, 180, 209
Pike, Mr. and Mrs., 105-7, 111
Ping-yüe, 41
Pollard, S., 135
Portuguese, 80, 217
Postal Commissioners, 39, 91, 92, 106
System, 91-2
Presbyterian Mission, 165, 210-6
Pukow Ferry, 18

Railways, 17, 18, 220


Canton to Hong Kong, 220
Changsha to Chuchow, 150
French, 18, 36
Haiphong to Yünnanfu, 36-8
Hankow to Canton, 41
Peking to Hankow, 18
Shanghai to Hangchow, 31-2
Shanghai to Peking, 17
Shihchiah Chwang to Taiyuanfu, 18, 19
Tsinan to Tsingtau, 24
Rawlinson, 185
Red Cross, 25, 143, 150
Religion, 194-5
Renaissance, 194
Rest House, 34
Richthoven, Baron v., 62
“Ritual of Chau,” 176
River Traffic, 43, 112, 142-3
Rockefeller Institution, 22, 152, 185
Roman Catholics, 96, 151
“Rules for Women,” 176

Scouts, Boy, 26
Script, New, 54, 55
Seaports, Ch. X
Sericulture, 52, 209
Shanghai, 17, 28-31, 197
Shansi, 19, 49
Shantung, 24, 27, 195
Shenchowfu, 146-8
Shihchiah Chwang, 18
Shrines, Wayside, 99, 100
Sianfu, 54
Siang-Kiang, 42
Slichter, Mr. and Mrs., 97
Smuts, General, 204
Soap Tree, 100
Social Welfare, 29, 201
Soldiers, 24
S. S. Lines—
Changsha to Hankow, 42, 150
Changteh to Changsha, 42
Hankow to Shanghai, 42
Hong Kong to Haiphong, 36
Hong Kong to Macao, 217
Hong Kong to Swatow, 216
Shanghai to Hong Kong, 36
Standard Oil Coy., 148
Stone, Dr. Mary, 72
Student Movement, Ch. IX, 182
Student Strikes, 182-4, 191
Sun Yat Sen, 171
Swatow, 131, 185, 212-6
Symbolism, 83
Szechuan, 159

Taiyuanfu, 17, 18, Ch. II


Tan Family, 213-4
Taoism, 43, 94
Ta-ting, 102
Temples, 43, 54, 112, 194, 215, 219
Tengyueh, 39, 71
Ten-ten, 98
“Tide of New Thought,” 191
Tientsin, 24
Ting Fang Lew, 194
Tin-mines, 72
Tong Ting Lake, 42, 150
Trade and Commerce, 43, 171, 166, 209
Tribes-people, Ch. V
list of, 123-4
Trinity College, Foochow, 209
Tsai Yuanpei, 197
Tsao, Lady, 176
Tseng, Miss, Ch. VIII
Marquis, 178
Tsinanfu, 23-7
Tsingchoufu, 25
Tsingtau, 192
Tungsten, 42

Universities—
Hong Kong, 197-8
Peking, 197
St. John’s, Shanghai, 147
Shantung Christian, 24

Varnish tree, 98

Wang Ch’ang Ling, 24


Wang, L. K, 208
Wang of Amoy, 211
War Lords, 171
Warren, Dr., 154
Wênchowfu, 205
West Lake, Hangchow, 24, 35
Hotel, 35
White wax, 144
Whyte, Dr., 215
Wight, Dr., 214
Witchcraft, 135-6
Witt, Dr., 146
Women, Chinese, 174-7, 185
Nurses, 185
“Wooden Combs,” 124
Wordsworth, 116
Workhouse, 54
Wu-chang, 43
Wu Pei Fu, General, 164, 222
Wu-Ting-Fang, 135

Yale in China, 151, 184


Yangtze River, 42-5
Yen Hsi Shan, Ch. II, 70, 194
Yi-ling, 78
Y.M.C.A., 29, 70, 153, 211
Youth of China, Ch. IX
Yuan-Chowfu, 143
Yuan Shi Kai, 192, 221
Yüen Kiang, 41
Yünnanfu, 37, 66-75
Yünnan Pass, 40
Yünnan Province, Ch. III, 38

Printed in Great Britain by Butler & Tanner, Frome and London


*** END OF THE PROJECT GUTENBERG EBOOK CHINESE
METTLE ***

Updated editions will replace the previous one—the old editions


will be renamed.

Creating the works from print editions not protected by U.S.


copyright law means that no one owns a United States copyright
in these works, so the Foundation (and you!) can copy and
distribute it in the United States without permission and without
paying copyright royalties. Special rules, set forth in the General
Terms of Use part of this license, apply to copying and
distributing Project Gutenberg™ electronic works to protect the
PROJECT GUTENBERG™ concept and trademark. Project
Gutenberg is a registered trademark, and may not be used if
you charge for an eBook, except by following the terms of the
trademark license, including paying royalties for use of the
Project Gutenberg trademark. If you do not charge anything for
copies of this eBook, complying with the trademark license is
very easy. You may use this eBook for nearly any purpose such
as creation of derivative works, reports, performances and
research. Project Gutenberg eBooks may be modified and
printed and given away—you may do practically ANYTHING in
the United States with eBooks not protected by U.S. copyright
law. Redistribution is subject to the trademark license, especially
commercial redistribution.

START: FULL LICENSE


THE FULL PROJECT GUTENBERG LICENSE
PLEASE READ THIS BEFORE YOU DISTRIBUTE OR USE THIS WORK

To protect the Project Gutenberg™ mission of promoting the


free distribution of electronic works, by using or distributing this
work (or any other work associated in any way with the phrase
“Project Gutenberg”), you agree to comply with all the terms of
the Full Project Gutenberg™ License available with this file or
online at www.gutenberg.org/license.

Section 1. General Terms of Use and


Redistributing Project Gutenberg™
electronic works
1.A. By reading or using any part of this Project Gutenberg™
electronic work, you indicate that you have read, understand,
agree to and accept all the terms of this license and intellectual
property (trademark/copyright) agreement. If you do not agree to
abide by all the terms of this agreement, you must cease using
and return or destroy all copies of Project Gutenberg™
electronic works in your possession. If you paid a fee for
obtaining a copy of or access to a Project Gutenberg™
electronic work and you do not agree to be bound by the terms
of this agreement, you may obtain a refund from the person or
entity to whom you paid the fee as set forth in paragraph 1.E.8.

1.B. “Project Gutenberg” is a registered trademark. It may only


be used on or associated in any way with an electronic work by
people who agree to be bound by the terms of this agreement.
There are a few things that you can do with most Project
Gutenberg™ electronic works even without complying with the
full terms of this agreement. See paragraph 1.C below. There
are a lot of things you can do with Project Gutenberg™
electronic works if you follow the terms of this agreement and
help preserve free future access to Project Gutenberg™
electronic works. See paragraph 1.E below.
1.C. The Project Gutenberg Literary Archive Foundation (“the
Foundation” or PGLAF), owns a compilation copyright in the
collection of Project Gutenberg™ electronic works. Nearly all the
individual works in the collection are in the public domain in the
United States. If an individual work is unprotected by copyright
law in the United States and you are located in the United
States, we do not claim a right to prevent you from copying,
distributing, performing, displaying or creating derivative works
based on the work as long as all references to Project
Gutenberg are removed. Of course, we hope that you will
support the Project Gutenberg™ mission of promoting free
access to electronic works by freely sharing Project
Gutenberg™ works in compliance with the terms of this
agreement for keeping the Project Gutenberg™ name
associated with the work. You can easily comply with the terms
of this agreement by keeping this work in the same format with
its attached full Project Gutenberg™ License when you share it
without charge with others.

1.D. The copyright laws of the place where you are located also
govern what you can do with this work. Copyright laws in most
countries are in a constant state of change. If you are outside
the United States, check the laws of your country in addition to
the terms of this agreement before downloading, copying,
displaying, performing, distributing or creating derivative works
based on this work or any other Project Gutenberg™ work. The
Foundation makes no representations concerning the copyright
status of any work in any country other than the United States.

1.E. Unless you have removed all references to Project


Gutenberg:

1.E.1. The following sentence, with active links to, or other


immediate access to, the full Project Gutenberg™ License must
appear prominently whenever any copy of a Project
Gutenberg™ work (any work on which the phrase “Project
Gutenberg” appears, or with which the phrase “Project
Gutenberg” is associated) is accessed, displayed, performed,
viewed, copied or distributed:

This eBook is for the use of anyone anywhere in the United


States and most other parts of the world at no cost and with
almost no restrictions whatsoever. You may copy it, give it
away or re-use it under the terms of the Project Gutenberg
License included with this eBook or online at
www.gutenberg.org. If you are not located in the United
States, you will have to check the laws of the country where
you are located before using this eBook.

1.E.2. If an individual Project Gutenberg™ electronic work is


derived from texts not protected by U.S. copyright law (does not
contain a notice indicating that it is posted with permission of the
copyright holder), the work can be copied and distributed to
anyone in the United States without paying any fees or charges.
If you are redistributing or providing access to a work with the
phrase “Project Gutenberg” associated with or appearing on the
work, you must comply either with the requirements of
paragraphs 1.E.1 through 1.E.7 or obtain permission for the use
of the work and the Project Gutenberg™ trademark as set forth
in paragraphs 1.E.8 or 1.E.9.

1.E.3. If an individual Project Gutenberg™ electronic work is


posted with the permission of the copyright holder, your use and
distribution must comply with both paragraphs 1.E.1 through
1.E.7 and any additional terms imposed by the copyright holder.
Additional terms will be linked to the Project Gutenberg™
License for all works posted with the permission of the copyright
holder found at the beginning of this work.

1.E.4. Do not unlink or detach or remove the full Project


Gutenberg™ License terms from this work, or any files
containing a part of this work or any other work associated with
Project Gutenberg™.
1.E.5. Do not copy, display, perform, distribute or redistribute
this electronic work, or any part of this electronic work, without
prominently displaying the sentence set forth in paragraph 1.E.1
with active links or immediate access to the full terms of the
Project Gutenberg™ License.

1.E.6. You may convert to and distribute this work in any binary,
compressed, marked up, nonproprietary or proprietary form,
including any word processing or hypertext form. However, if
you provide access to or distribute copies of a Project
Gutenberg™ work in a format other than “Plain Vanilla ASCII” or
other format used in the official version posted on the official
Project Gutenberg™ website (www.gutenberg.org), you must, at
no additional cost, fee or expense to the user, provide a copy, a
means of exporting a copy, or a means of obtaining a copy upon
request, of the work in its original “Plain Vanilla ASCII” or other
form. Any alternate format must include the full Project
Gutenberg™ License as specified in paragraph 1.E.1.

1.E.7. Do not charge a fee for access to, viewing, displaying,


performing, copying or distributing any Project Gutenberg™
works unless you comply with paragraph 1.E.8 or 1.E.9.

1.E.8. You may charge a reasonable fee for copies of or


providing access to or distributing Project Gutenberg™
electronic works provided that:

• You pay a royalty fee of 20% of the gross profits you derive from
the use of Project Gutenberg™ works calculated using the
method you already use to calculate your applicable taxes. The
fee is owed to the owner of the Project Gutenberg™ trademark,
but he has agreed to donate royalties under this paragraph to
the Project Gutenberg Literary Archive Foundation. Royalty
payments must be paid within 60 days following each date on
which you prepare (or are legally required to prepare) your
periodic tax returns. Royalty payments should be clearly marked
as such and sent to the Project Gutenberg Literary Archive
Foundation at the address specified in Section 4, “Information
about donations to the Project Gutenberg Literary Archive
Foundation.”

• You provide a full refund of any money paid by a user who


notifies you in writing (or by e-mail) within 30 days of receipt that
s/he does not agree to the terms of the full Project Gutenberg™
License. You must require such a user to return or destroy all
copies of the works possessed in a physical medium and
discontinue all use of and all access to other copies of Project
Gutenberg™ works.

• You provide, in accordance with paragraph 1.F.3, a full refund of


any money paid for a work or a replacement copy, if a defect in
the electronic work is discovered and reported to you within 90
days of receipt of the work.

• You comply with all other terms of this agreement for free
distribution of Project Gutenberg™ works.

1.E.9. If you wish to charge a fee or distribute a Project


Gutenberg™ electronic work or group of works on different
terms than are set forth in this agreement, you must obtain
permission in writing from the Project Gutenberg Literary
Archive Foundation, the manager of the Project Gutenberg™
trademark. Contact the Foundation as set forth in Section 3
below.

1.F.

1.F.1. Project Gutenberg volunteers and employees expend


considerable effort to identify, do copyright research on,
transcribe and proofread works not protected by U.S. copyright
law in creating the Project Gutenberg™ collection. Despite
these efforts, Project Gutenberg™ electronic works, and the
medium on which they may be stored, may contain “Defects,”
such as, but not limited to, incomplete, inaccurate or corrupt
data, transcription errors, a copyright or other intellectual
property infringement, a defective or damaged disk or other
medium, a computer virus, or computer codes that damage or
cannot be read by your equipment.

1.F.2. LIMITED WARRANTY, DISCLAIMER OF DAMAGES -


Except for the “Right of Replacement or Refund” described in
paragraph 1.F.3, the Project Gutenberg Literary Archive
Foundation, the owner of the Project Gutenberg™ trademark,
and any other party distributing a Project Gutenberg™ electronic
work under this agreement, disclaim all liability to you for
damages, costs and expenses, including legal fees. YOU
AGREE THAT YOU HAVE NO REMEDIES FOR NEGLIGENCE,
STRICT LIABILITY, BREACH OF WARRANTY OR BREACH
OF CONTRACT EXCEPT THOSE PROVIDED IN PARAGRAPH
1.F.3. YOU AGREE THAT THE FOUNDATION, THE
TRADEMARK OWNER, AND ANY DISTRIBUTOR UNDER
THIS AGREEMENT WILL NOT BE LIABLE TO YOU FOR
ACTUAL, DIRECT, INDIRECT, CONSEQUENTIAL, PUNITIVE
OR INCIDENTAL DAMAGES EVEN IF YOU GIVE NOTICE OF
THE POSSIBILITY OF SUCH DAMAGE.

1.F.3. LIMITED RIGHT OF REPLACEMENT OR REFUND - If


you discover a defect in this electronic work within 90 days of
receiving it, you can receive a refund of the money (if any) you
paid for it by sending a written explanation to the person you
received the work from. If you received the work on a physical
medium, you must return the medium with your written
explanation. The person or entity that provided you with the
defective work may elect to provide a replacement copy in lieu
of a refund. If you received the work electronically, the person or
entity providing it to you may choose to give you a second
opportunity to receive the work electronically in lieu of a refund.
If the second copy is also defective, you may demand a refund
in writing without further opportunities to fix the problem.

1.F.4. Except for the limited right of replacement or refund set


forth in paragraph 1.F.3, this work is provided to you ‘AS-IS’,
WITH NO OTHER WARRANTIES OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO
WARRANTIES OF MERCHANTABILITY OR FITNESS FOR
ANY PURPOSE.

1.F.5. Some states do not allow disclaimers of certain implied


warranties or the exclusion or limitation of certain types of
damages. If any disclaimer or limitation set forth in this
agreement violates the law of the state applicable to this
agreement, the agreement shall be interpreted to make the
maximum disclaimer or limitation permitted by the applicable
state law. The invalidity or unenforceability of any provision of
this agreement shall not void the remaining provisions.

1.F.6. INDEMNITY - You agree to indemnify and hold the


Foundation, the trademark owner, any agent or employee of the
Foundation, anyone providing copies of Project Gutenberg™
electronic works in accordance with this agreement, and any
volunteers associated with the production, promotion and
distribution of Project Gutenberg™ electronic works, harmless
from all liability, costs and expenses, including legal fees, that
arise directly or indirectly from any of the following which you do
or cause to occur: (a) distribution of this or any Project
Gutenberg™ work, (b) alteration, modification, or additions or
deletions to any Project Gutenberg™ work, and (c) any Defect
you cause.

Section 2. Information about the Mission of


Project Gutenberg™
Project Gutenberg™ is synonymous with the free distribution of
electronic works in formats readable by the widest variety of
computers including obsolete, old, middle-aged and new
computers. It exists because of the efforts of hundreds of
volunteers and donations from people in all walks of life.

Volunteers and financial support to provide volunteers with the


assistance they need are critical to reaching Project
Gutenberg™’s goals and ensuring that the Project Gutenberg™
collection will remain freely available for generations to come. In
2001, the Project Gutenberg Literary Archive Foundation was
created to provide a secure and permanent future for Project
Gutenberg™ and future generations. To learn more about the
Project Gutenberg Literary Archive Foundation and how your
efforts and donations can help, see Sections 3 and 4 and the
Foundation information page at www.gutenberg.org.

Section 3. Information about the Project


Gutenberg Literary Archive Foundation
The Project Gutenberg Literary Archive Foundation is a non-
profit 501(c)(3) educational corporation organized under the
laws of the state of Mississippi and granted tax exempt status by
the Internal Revenue Service. The Foundation’s EIN or federal
tax identification number is 64-6221541. Contributions to the
Project Gutenberg Literary Archive Foundation are tax
deductible to the full extent permitted by U.S. federal laws and
your state’s laws.

The Foundation’s business office is located at 809 North 1500


West, Salt Lake City, UT 84116, (801) 596-1887. Email contact
links and up to date contact information can be found at the
Foundation’s website and official page at
www.gutenberg.org/contact

Section 4. Information about Donations to


the Project Gutenberg Literary Archive
Foundation
Project Gutenberg™ depends upon and cannot survive without
widespread public support and donations to carry out its mission
of increasing the number of public domain and licensed works
that can be freely distributed in machine-readable form
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookmass.com

You might also like