Showing posts with label Data Engineering. Show all posts
Showing posts with label Data Engineering. Show all posts

Saturday, July 11, 2026

How to Improve as a New Data Engineer in the AI Era

 Stepping into a Data Engineering role for the first time is daunting enough on its own. Add a company mandate to “extensively use AI tools,” and it’s fair to wonder: will leaning on AI from day one stunt my growth as an engineer?

Press enter or click to view image in full size

This is a real concern circulating among new and transitioning data engineers right now — and the good news is that experienced engineers have already worked through it. The consensus that emerges isn’t “avoid AI” or “let AI do the work.” It’s something more nuanced: AI doesn’t erode your skills — passivity does.

Press enter or click to view image in full size

Here’s how to make AI a tool that accelerates your growth instead of one that quietly replaces it.

Treat AI Like a Senior Engineer Looking Over Your Shoulder — Not an Oracle

The most useful mental model shared in discussions like this is to treat AI the way you’d treat a senior engineer sitting next to you: someone you interrogate, not someone you defer to.

Ask why things are done a certain way. Push back. Make it justify a decision instead of just accepting the first answer. This does double duty — it deepens your understanding, and it catches the AI when it’s confidently wrong.

That last point matters more than it sounds. One engineer put it plainly: reliance on LLMs, especially under deadline pressure, can quietly hollow out your skills. It happened to him — he had to go back and relearn things properly after leaning on AI too hard during a crunch.

Watch Out for Sycophancy — Ask Neutrally

LLMs have a well-documented tendency to agree with whatever direction you nudge them toward. If you ask a leading question, you’ll often get a leading answer.

Compare these two prompts:

Leading (weak):

“This loading table should’ve a clustered index, right?”

Response: “You’re absolutely right to think about it that way, it’s a very common and solid instinct in data modeling.”

Neutral (strong):

“Tell me the pros and cons of a clustered index on a loading table.”

Response: “A clustered index on a loading table can improve read performance and enforce data ordering… However, it slows down bulk inserts and loads because the data must be physically arranged and maintained during each write… For high-volume staging or loading scenarios, it is often better to load into a heap first and apply the clustered index afterward.”

The second version gives you an actual engineering trade-off instead of a compliment. Framing your questions neutrally is a small habit that consistently produces better, more honest answers — and it forces you to think in terms of trade-offs rather than confirmation.

Understand the Job Before You Automate It

One of the clearest frameworks to come out of this conversation breaks data work into a few core verticals:

  • Business — What does the company do? How does it make money? What do stakeholders actually care about?
  • Data context — How is upstream data generated and modeled? What are the key fact tables? What problems already exist in the warehouse?
    Problem definition — What are you actually solving, and why does it matter?
  • Output requirements — What’s really needed? (Does it actually need to be streaming, or is batch fine?)
  • Constraints — Tools, timelines, data quality checks, scope.
    Solution design — Connecting problem, context, and constraints into an actual solution.
  • Delivery and iteration — Demoing, monitoring, fixing bugs, closing tickets.

The first several steps require talking to people, not prompting a model. AI tends to produce solid output once your inputs, constraints, and outputs are already well-defined — but it’s not going to define them for you, and it often produces verbose or subtly broken code that needs careful review.

The takeaway: if you drive the design and use AI to execute, your skills grow. If you let AI drive the design, they atrophy.

Always Trace the Code Back Yourself

Multiple engineers converged on the same habit: after AI writes something, don’t just run it — take it apart.

If a tool writes your pipeline logic or a SQL query, spend time going through it line by line. Understand every join, every filter, every function you haven’t seen before. That’s genuinely where the learning happens — not in refusing to use AI, but in refusing to let its output pass through you unexamined.

One engineer even set up a habit of having AI walk itself back through its own decisions after finishing a task — asking things like “why did we left-join on X?” This turns the AI into both a code generator and a built-in code reviewer, which reinforces your understanding rather than replacing it.

As one comment summarized it well: it’s less about whether you can write the code from scratch, and more about whether you can describe the problem precisely enough to AI — and whether you can properly evaluate what comes back.

Your Analytics Background Is a Real Advantage

If you’re moving into Data Engineering from a data analyst background, don’t undersell that experience. Five years of analytics work means you already understand:

  • SQL fluency
  • Business logic and stakeholder priorities
  • What bad data looks like once it hits downstream reporting
  • Data quality intuition

That foundation transfers directly into Data Engineering and gives you a real edge over someone starting completely from scratch — AI-assisted workflows or not.

Business Use Cases: Where This Actually Plays Out

It’s easier to internalize “drive the design, let AI accelerate execution” when you can picture it against real work. Here’s what that looks like across a few common first-year Data Engineering scenarios:

  1. Retail demand forecasting pipeline — You decide which SKUs, stores, and seasonality windows actually matter to the business — AI can draft the aggregation SQL and the orchestration DAG around that. But only you (or the business) know that a promo event or a spike in returns will throw off a naive forecast. AI has no way to know that unless you tell it.
  2. Fraud or anomaly detection feeds — You set the risk thresholds and decide whether the use case genuinely needs real-time streaming or whether batch is good enough (a constraint check straight out of the framework above). AI can help scaffold the transformation logic, but the cost of a wrong threshold — blocking legitimate customers, or missing real fraud — is a business call, not a coding one.
  3. Marketing attribution models — Multiple ad platforms, overlapping touchpoints, and stakeholders who all define “attribution” slightly differently make this a political and business-context problem before it’s a SQL problem. AI can help draft the dbt models and join logic once you and the marketing team agree on what counts. Your job is to be able to explain, line by line, why a campaign’s numbers moved — because someone will ask.
  4. Financial or compliance reporting automation — These pipelines tend to have strict, well-defined outputs and heavy data-quality requirements — exactly the kind of “clean template” scenario where AI-generated code performs best. But because errors here have real consequences, review isn’t optional: you’re expected to justify every transformation if an auditor asks.

The common thread: in each case, the valuable work — understanding the business need, defining constraints, catching the edge case AI can’t see — is still yours. AI just removes the friction of writing the boilerplate around it.

What to Actually Study

Beyond the AI-usage mindset, there are concrete technical areas worth focusing on as you ramp up:

  • Spark and Databricks (or your team’s equivalent big-data processing stack)
  • Data modeling fundamentals
  • Orchestration (Airflow, Dagster, or whatever your team uses)
  • APIs — building and consuming them
  • Debugging — real, hands-on troubleshooting, not just reading stack traces
  • Cloud fundamentals relevant to your stack (AWS, Azure, GCP)
  • End-to-end data flow — understanding a pipeline from raw ingestion to the dashboard a stakeholder actually looks at

Practical Ground Rules Going Forward

If you distill all of this into a working philosophy, it comes down to a short list:

  1. Use AI to prototype and explore, not to think for you.
  2. Ask neutral, open-ended questions rather than leading ones.
  3. Review everything line by line — especially the parts you don’t immediately understand.
  4. Keep ownership of design decisions. Let AI accelerate execution, not replace judgment.
  5. Remember what an LLM actually is: a next-token prediction system trained on internet data, complete with its biases and blind spots. It doesn’t “know” anything — it’s on you to supply the right context and catch it when it’s confidently wrong.
  6. “Correct” code is cheap now. Clean, maintainable code is not. That distinction is exactly where your judgment as an engineer still matters.

AI won’t stunt your growth if you stay in the driver’s seat on design and understanding. It will if you let AI make decisions for you and just ship what it produces.

Concrete practices that came up repeatedly:

  1. Ask neutrally, not leadingly. LLMs are sycophantic — if you phrase a question with a hint of your own opinion baked in (“shouldn’t this have a clustered index?”), you’ll get agreement, not analysis. Ask for pros/cons or trade-offs instead, and you’ll get a more honest answer.
  2. Treat AI like a senior engineer looking over your shoulder, not a replacement for one. Ask it to justify choices, push back on its reasoning, and catch it when it’s confidently wrong (which it will be — it’s a next-token predictor, not a domain expert, and it inherits whatever bias/misinformation is in its training data).
  3. Design first, generate second. Brainstorm your approach and constraints yourself, then have AI help write code against that well-defined plan. Turning it loose without a clear spec tends to waste time and produce verbose, buggy output.
  4. Trace back what it did, line by line. If AI writes you a pipeline or SQL query, don’t just run it — pull it apart until you understand every join, filter, and function. That review process is where the actual learning happens, not in avoiding the tool.
  5. Your analytics background is a real asset, not a handicap. You already have SQL fluency, business context, and an instinct for what bad data looks like downstream — that’s a head start most new DEs don’t have.

One person also laid out a useful mental framework for thinking about DE work more broadly — business context, data context, problem definition, output requirements, constraints, solution design, then continuous improvement — and pointed out that steps 1–5 of that require talking to actual stakeholders, which AI can’t do for you.

Skills to prioritize (per the thread): Spark/Databricks, data modeling, orchestration, APIs, debugging, cloud fundamentals, and end-to-end data flow — the stuff that lets you evaluate whether AI’s output is actually correct, not just plausible-looking.

The Bottom Line

Using AI extensively in your first Data Engineering role won’t stunt your growth — as long as you stay the one steering. The engineers who lose skills to AI are the ones who stop asking “why,” stop tracing the logic back, and let the tool make decisions instead of just accelerating the ones they’ve already made.

Your job isn’t to write every line of code by hand anymore. It’s to understand the system well enough to know when the AI is wrong — and that’s a skill no amount of prompting can substitute for.

Wednesday, November 15, 2023

PySpark — Retrieve matching rows from two Dataframes

Data integrity refers to the quality, consistency, and reliability of data throughout its life cycle. Data engineering pipelines are methods and structures that collect, transform, store, and analyse data from many sources.

If you are working as a PySpark developer, data engineer, data analyst, or data scientist for any organisation requires you to be familiar with dataframes because data manipulation is the act of transforming, cleansing, and organising raw data into a format that can be used for analysis and decision making.


For example, you have some user’s data in dataframe-1, and you have to new users’ data in a dataframe-2, then you must find out all the matched records from dataframe-2 and dataframe-1. In PySpark, you can retrieve matching rows from two Dataframes using the join operation. The join operation combines rows from two Dataframes based on a common column.

# importing sparksession from  
from pyspark.sql import SparkSession
# pyspark.sql module
from pyspark.sql.functions import col
# Create a Spark session and giving an app name
spark = SparkSession.builder.appName("UpdateMutliColumns"
).getOrCreate()

Dataset 1: In this dataset, we have three columns such as Name, Age and Occupation and have a pre-defined schema for our PySpark dataframe as given below — 

# Sample data for DataFrame1
dataset1 = [("Ryan Arjun"
, 25, "Engineer"),          ("Kimmy Wang", 30, "Data Scientist"),          ("Saurabh Yadav", 22, "Analyst")]

# Define the schema for DataFrame1
ds_schema1 = ["Name"
, "Age", "Occupation"]

PySpark Dataframe 1 from dataset 1 — In PySpark, we are going to call already existing pre-defined createDataFrame function which takes two parameters such as data and schema and passing the above dataset1 and ds_schema1 as given below-  


# Create DataFrames
df1 = spark.createDataFrame(dataset1, schema=ds_schema1)

### show the schema of the dataframe
df1.printSchema()
# Show the original DataFrames
print("DataFrame 1:")
df1.show()



Dataset 2:
 In this dataset, we have three columns such as Name, Sex and Country and have a pre-defined schema for our PySpark dataframe as given below —

# Sample data for DataFrame2
dataset2 = [("Ryan Arjun"
, "Male", "Indian"),          ("Kimmy Wang", "Female", "Japan"),          ("Lovish Singh", "Male", "China")]

# Define the schema for DataFrame2
ds_schema2 = ["Name"
, "Gender", "Country"]

 

PySpark Dataframe 2 from dataset 2 — In PySpark, we are going to call already existing pre-defined createDataFrame function which takes two parameters such as data and schema and passing the above dataset1 and ds_schema2 as given below-

# Create DataFrames for second dataset
df2 = spark.createDataFrame(dataset2, schema=ds_schema2)
### show the schema of the dataframe
df2.printSchema()
# Show the original DataFrames
print("DataFrame 2:") df2.show()


Get matching records from both dataframes — In this example, df1.join(df2, “Name”, “inner”) performs an inner join based on the “Name” column. The resulting DataFrame, joined_df, contains only the rows where the “Name” column is common in both Dataframes as given below —

# Join DataFrames based on the "Name" column
joined_df = df1.join(df2, "Name", "inner")
### show the schema of the dataframe
joined_df.printSchema()
# Show the original DataFrames
print("DataFrame with Matching rows:")
joined_df.show()



Note: You can adjust the join type (inner, left, right, full) based on your specific requirements. Additionally, if the column names are different in the two Dataframes, you can specify the join condition explicitly using the on parameter. You can adjust the join condition based on your specific use case and column names.

 

Now, you can see that it is just piece of cake to get the matching records from both dataframe based on your matching keys.

Lets learn more on the data validation side which is the most important part of the data engineering.

Data validation — Data validation is the process of checking the data against predefined rules and standards, such as data types, formats, ranges, and constraints.

  1. 💫Schema Validation: Verify data adherence to predefined schemas, checking types, formats, and structures.
  2. 💫Integrity Constraints: Enforce rules and constraints to maintain data integrity, preventing inconsistencies.
  3. 💫Cross-Field Validation: Validate relationships and dependencies between different fields to ensure logical coherence.
  4. 💫Data Quality Metrics: Define and track quality metrics, such as completeness, accuracy, and consistency.
  5. 💫Automated Validation Scripts: Develop and run automated scripts to check data against predefined rules and criteria.

 

To learn more, please follow us -
🔊 http://www.sql-datatools.com

To Learn more, please visit our YouTube channel at —
🔊 http://www.youtube.com/c/Sql-datatools

To Learn more, please visit our Instagram account at -
🔊 https://www.instagram.com/asp.mukesh/

To Learn more, please visit our twitter account at -
🔊
 https://twitter.com/macxima