概念
Merging data from multiple sources
Join and union data from several sources: clean the keys first, pick the tool by size.
本课尚未翻译,暂以英文显示。
- 1Read the orders from the database.
- 2Read the click files from S3.
- 3Cast and clean the keys so they match, and union files by column name.
- 4Join, and write the result as Parquet in the curated zone.
分步说明
- 1Read the orders from the database.
- 2Read the click files from S3.
- 3Cast and clean the keys so they match, and union files by column name.
- 4Join, and write the result as Parquet in the curated zone.
Two sources, aligned keys, a join and a Parquet result.
Fits in memory
- Tool
- pandas
- Note
- Notebook or Processing job
SQL on S3 files
- Tool
- Athena CTAS
- Note
- Writes partitioned Parquet
Large data
- Tool
- Spark
- Note
- Glue or EMR. Broadcast or shuffle join
Only new data
- Tool
- Glue job bookmark
- Note
- Remembers what was read
| Size or need | Tool | Note |
|---|---|---|
| Fits in memory | pandas | Notebook or Processing job |
| SQL on S3 files | Athena CTAS | Writes partitioned Parquet |
| Large data | Spark | Glue or EMR. Broadcast or shuffle join |
| Only new data | Glue job bookmark | Remembers what was read |
1 / 2
Fits in memory
- Tool
- pandas
- Note
- Notebook or Processing job
SQL on S3 files
- Tool
- Athena CTAS
- Note
- Writes partitioned Parquet
Large data
- Tool
- Spark
- Note
- Glue or EMR. Broadcast or shuffle join
| Size or need | Tool | Note |
|---|---|---|
| Fits in memory | pandas | Notebook or Processing job |
| SQL on S3 files | Athena CTAS | Writes partitioned Parquet |
| Large data | Spark | Glue or EMR. Broadcast or shuffle join |
2 / 2
Only new data
- Tool
- Glue job bookmark
- Note
- Remembers what was read
| Size or need | Tool | Note |
|---|---|---|
| Only new data | Glue job bookmark | Remembers what was read |
是什么
Merging has two shapes. A join adds columns: orders get the customer record that matches their key. A union adds rows: files with the same layout stack into one table. Most failures come from the data, not the tool. Keys differ in type (a number in one source, text in another), in case, in spaces or in leading zeros. Schema drift adds, renames or retypes columns over time, so a union by position silently misaligns data. Clean and cast the keys first, and union by column name.
是什么
Pick the tool by size. Pandas joins small data in memory, in a notebook or a Processing job. Athena CTAS (CREATE TABLE AS SELECT) joins data in S3 with SQL and writes the result as partitioned Parquet. Spark in AWS Glue or Amazon EMR joins large data. A Spark broadcast join sends a small table to every worker, so the large table does not move: Spark does this by default for tables under 10 MB. A shuffle join moves both tables by key across the cluster and is slower, and a skewed key makes one worker slow.
是什么
For new data only, a Glue job bookmark remembers what a job already read, so the next run reads only new files or rows. In Glue, a DynamicFrame tolerates a column that has mixed types with a choice type that you resolve with a cast. Merge in the curated zone of the lake, and keep the raw sources untouched.
要记住
- Join adds columns by key. Union adds rows with the same layout.
- Align key type, case, spaces and leading zeros before joining.
- Schema drift: union by column name, not by position.
- Small: pandas. SQL on S3: Athena CTAS. Large: Spark in Glue or EMR.
- Broadcast join for one small table (default under 10 MB). Shuffle join for two large ones.
要记住
- Glue job bookmarks load only new data on each run.
考试中
- “Join a small lookup table with billions of rows in Spark” points to a broadcast join.
- “Each nightly run must read only new files” points to Glue job bookmarks.
- “Join S3 tables with SQL and save the result as Parquet” points to Athena CTAS.
本任务内容 · 1.1
- S3 as the ML data lake
- Choosing storage: S3, EFS, EBS, FSx and transfer tools
- Extracting data from databases and search
- Data formats: Parquet, ORC, Avro, CSV, JSON, RecordIO
Kinesis Data Streams
Firehose
Managed Flink
MSK
- Troubleshooting ingestion and storage capacity
Catalog and Lake Formation
- Merging data from multiple sources
- Choosing and configuring a vector store
OpenSearch
- Aurora and RDS PostgreSQL with pgvector
- Ingesting text, image, audio and video
- Ingesting data into SageMaker Feature Store