Databases Reference
In-Depth Information
CHAPTER 4
Free-Form Query Import
The previous chapters covered the use cases where you had an input table on the source
database system and you needed to transfer the table as a whole or one part at a time
into the Hadoop ecosystem. This chapter, on the other hand, will focus on more ad‐
vanced use cases where you need to import data from more than one table or where you
need to customize the transferred data by calling various database functions.
For this chapter we've slightly altered the test table
cities
(see
Table 4-1
), normalizing
the country name to a standalone table called
countries
(see
Table 4-2
). The normalized
variant of the table
cities
is called
normcities
and will be created and populated
automatically via the script
mysql.tables.sql
as described in
Chapter 2
.
Table 4-1. Normalized cities
id
country_id
city
1
1
Palo Alto
2
2
Brno
3
1
Sunnyvale
Table 4-2. Countries
country_id
country
1
USA
2
Czech Republic