Generative AI for Data Engineers

Why should you be using ChatGPT as a data engineer?
ChatGPT and generative AI more broadly is all the rage nowadays. It seems like every company is pivoting to become an AI company. There are claims that ChatGPT will render engineers completely obsolete, that all knowledge workers will be replaced by monthly subscription.
I believe many of these claims are overblown, but ChatGPT does offer some real benefits for those who understand the specific use cases where it shines.
Instead of thinking of ChatGPT as a full-fledged automated engineer, I find it more helpful to think of ChatGPT as an assistant that excels at the most tedious parts of the job but whose work needs close monitoring.
What is ChatGPT?
First, let’s take a step back and discuss what exactly ChatGPT is. ChatGPT is the name of OpenAI’s generative AI model. It is trained on a wide corpus of text across the Internet with the purpose of being able to predict chains of text.
When does ChatGPT excel?
ChatGPT, like all other machine learning applications, really shines when the problems it’s solving have the following characteristics:
- The problems are frequently encountered
- There are checks and review processes in place to catch issues
- Accuracy is not the highest priority
- The solutions are well-established
- You are able to provide the needed context
The problems are frequently encountered
If you were to ask ChatGPT whether the Federal Reserve will lower interest rates in the next quarter, ChatGPT could give you a convincing answer. The problem is that the exact conditions of the next quarter have never been encountered in the past.
There are checks and review processes in place to catch issues
ChatGPT does not have common sense. This can lead to answers that are comically incorrect and potentially harmful if used.
Accuracy is not the highest priority
This point goes hand-in-hand with the previous one, but I’d like to reiterate that ChatGPT should not be used when accuracy is the most important factor. If you are designing a rocket ship, you probably shouldn’t rely on ChatGPT to calculate the structural integrity demands of the journey. A small mistake could be a tragedy.
On the other side, ChatGPT could be great for brainstorming new product ideas. In this case, we don’t expect any accuracy from ChatGPT. Instead, we want to stimulate our own creative process and anything generated will be used as a starting point.
The solutions are well-established
Similar to our above example with the Federal Reserve, whether or not the Fed raises interest rates in the next quarter is a highly contentious debated point with no clear consensus. ChatGPT has been trained on incredibly mixed opinions and could generate conflicting answers to the same question.
ChatGPT’s answers will only be as accurate as the material used to train it. If, instead, you ask ChatGPT a question like “What was the population of the United States in the year 2000?” it will almost definitely give you an accurate answer. This is because it has been trained on a consistent answer to this question.
You are able to provide the needed context
This is probably the most important point. For an obvious example, you can’t ask ChatGPT how to fix your code if you can’t give ChatGPT your code or even the error message you are receiving.
10 specific use cases
Below are ChatGPT use cases that I have found most helpful over the past few months.
1. Generating DDL or Queries
One of the more tedious aspects of being a data engineer is creating and formatting long SQL queries. For example, say you are creating a new data pipeline. You have a SELECT statement covering all the 30 fields in your final table along with a CSV sample that looks something like this:
SELECT
user_id,
first_name,
last_name,
email,
phone_number,
address,
city,
state,
zip_code,
country,
birth_date,
gender,
account_created_date,
last_login_date,
account_status,
total_purchases,
total_spent,
last_purchase_date,
loyalty_points,
preferred_payment_method,
membership_level
FROM
users;
The next step would be to painstakingly create the DDL to create that table. This task does not require a lot of skill — it is simply copying to field names from your CSV or SELECT statement to a new script along with specifying the data types.
This is where ChatGPT shines. You can feed in the SELECT statement along with CSV sample and instruct ChatGPT to generate the DDL script for you along with any indexes or other constraints that you might want.
I instructed ChatGPT to:
“Take the following SELECT statement and create DDL for it. I want to create or replace this table and put an index on the birth_date field. Come up with your best guess for the data types and whether it should be nullable”
And here is the response:
Here’s the DDL (Data Definition Language) to create or replace the table based on the given SELECT statement. I’ve added an index on the birth_date field and made educated guesses on the data types and nullability:
CREATE OR REPLACE TABLE users (
user_id INT NOT NULL,
first_name VARCHAR(100) NOT NULL,
last_name VARCHAR(100) NOT NULL,
email VARCHAR(255) NOT NULL,
phone_number VARCHAR(20),
address VARCHAR(255),
city VARCHAR(100),
state VARCHAR(50),
zip_code VARCHAR(10),
country VARCHAR(50),
birth_date DATE,
gender CHAR(1),
account_created_date TIMESTAMP NOT NULL,
last_login_date TIMESTAMP,
account_status VARCHAR(50) NOT NULL,
total_purchases INT DEFAULT 0,
total_spent DECIMAL(10, 2) DEFAULT 0.00,
last_purchase_date DATE,
loyalty_points INT DEFAULT 0,
preferred_payment_method VARCHAR(50),
membership_level VARCHAR(50),
PRIMARY KEY (user_id)
);
CREATE INDEX idx_birth_date ON users (birth_date);
Explanation:
- Data Types:
user_id:INTas it’s likely an integer ID and the primary key.first_name,last_name,city,state,country,account_status,preferred_payment_method,membership_level:VARCHARwith varying lengths based on typical usage.email:VARCHAR(255)to accommodate longer email addresses.phone_number:VARCHAR(20)assuming it includes formatting characters like+and ``.zip_code:VARCHAR(10)to allow for both US and international formats.birth_date,last_purchase_date:DATEsince these represent dates.gender:CHAR(1)to store a single character for gender.account_created_date,last_login_date:TIMESTAMPto capture both date and time.total_purchases,loyalty_points:INTfor numeric values.total_spent:DECIMAL(10, 2)to handle amounts with two decimal places.
- Nullability:
- Fields like
user_id,first_name,last_name,email,account_created_date, andaccount_statusareNOT NULLas they seem essential. - Other fields are nullable or have default values, depending on whether they are optional or may not always be populated.
- Fields like
- Index:
- The
birth_datefield is indexed withCREATE INDEX idx_birth_date ON users (birth_date);to improve query performance on that column.
- The
As you can see it provided a pretty decent script for us to start with along with all of the reasoning.
2. Generating connector code
One of the more common tasks I have seen is generating connector code to integrate with third-party APIs. These follow similar formats and this code has generally been written 100s of times before with, hopefully, documentation.
This is another great use case for ChatGPT. Because this connector code for a given API is similar or the same, ChatGPT has generally been trained on some instances of this code. Let’s take a connection to Google Analytics’ API a common source to pull from.
Once again ChatGPT provides a great starting template to extract this data. This isn’t production ready code, but it provides a jumping off point for common extraction tasks
To connect to Google Analytics and extract data for daily ingestion into a Snowflake table, you’ll need to use the google-analytics-data package for accessing Google Analytics and snowflake-connector-python for loading data into Snowflake. Here’s a step-by-step guide and sample code to accomplish this.
Step 1: Set Up Google Analytics API
- Enable the Google Analytics API in the Google Cloud Console.
- Create service account credentials and download the JSON key file.
-
Install required packages:
pip install google-analytics-data snowflake-connector-python
Step 2: Python Code to Extract Data and Load into Snowflake
import json
import os
import snowflake.connector
from google.analytics.data_v1beta import BetaAnalyticsDataClient
from google.analytics.data_v1beta.types import DateRange, Dimension, Metric, RunReportRequest
# Set up Google Analytics client
def initialize_analytics_client():
# Replace with the path to your service account JSON key file
key_file = 'path_to_your_service_account_key.json'
os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = key_file
client = BetaAnalyticsDataClient()
return client
# Fetch data from Google Analytics
def fetch_analytics_data(client):
request = RunReportRequest(
property='properties/YOUR_PROPERTY_ID', # Replace with your property ID
dimensions=[Dimension(name='date'), Dimension(name='country')],
metrics=[Metric(name='activeUsers'), Metric(name='newUsers')],
date_ranges=[DateRange(start_date='yesterday', end_date='yesterday')]
)
response = client.run_report(request)
return response
# Connect to Snowflake
def connect_to_snowflake():
conn = snowflake.connector.connect(
user='YOUR_SNOWFLAKE_USER',
password='YOUR_SNOWFLAKE_PASSWORD',
account='YOUR_SNOWFLAKE_ACCOUNT',
warehouse='YOUR_WAREHOUSE',
database='YOUR_DATABASE',
schema='YOUR_SCHEMA'
)
return conn
# Insert data into Snowflake
def insert_data_into_snowflake(conn, data):
cursor = conn.cursor()
for row in data:
date, country, active_users, new_users = row.dimension_values[0].value, row.dimension_values[1].value, row.metric_values[0].value, row.metric_values[1].value
sql = f"""
INSERT INTO analytics_data (date, country, active_users, new_users)
VALUES ('{date}', '{country}', {active_users}, {new_users});
"""
cursor.execute(sql)
cursor.close()
conn.commit()
# Main function to run the ETL process
def run_etl():
analytics_client = initialize_analytics_client()
analytics_data = fetch_analytics_data(analytics_client).rows
snowflake_conn = connect_to_snowflake()
insert_data_into_snowflake(snowflake_conn, analytics_data)
snowflake_conn.close()
# Run the ETL process daily
if __name__ == '__main__':
run_etl()
Step 3: Explanation and Customization
- Google Analytics Setup:
- Replace
'YOUR_PROPERTY_ID'with your actual Google Analytics property ID. - Modify dimensions and metrics in the
fetch_analytics_datafunction as needed.
- Replace
- Snowflake Connection:
- Replace
'YOUR_SNOWFLAKE_USER','YOUR_SNOWFLAKE_PASSWORD','YOUR_SNOWFLAKE_ACCOUNT','YOUR_WAREHOUSE','YOUR_DATABASE', and'YOUR_SCHEMA'with your Snowflake credentials.
- Replace
- Table Structure:
-
Ensure your Snowflake table (
analytics_data) has the following structure or modify the SQL insert statement accordingly:CREATE TABLE analytics_data ( date DATE, country STRING, active_users INT, new_users INT );
-
- Execution:
- You can schedule this script using a cron job or any task scheduler to run daily.
This script initializes a connection to Google Analytics, fetches the required data, and inserts it into a Snowflake table. Modify it based on your specific use case and data structure.
3. Generating documentation
Code is written once but can be read hundreds of times. This means code readability is critical and one of the distinguishing traits between a junior and senior engineer, but let’s face it — it can be tedious to do. And even though we may intend on always creating well-documented code, it’s easy to let documentation slip in the day-to-day rush.
ChatGPT can do a great job analyzing code and generating documentation. This can range from specific function level comments to higher-level architecture wikis.
I will write quick comments explaining my reasoning for certain pieces of the code. Then after everything is written I feed the code, along with the extra comments as context, into ChatGPT to generate overarching documentation for specific functions. It generally provides a great starting point upon which you can expand.
4. Drafting internal data comms
Communicating to internal stakeholder becomes more important as you progress in your career. A junior engineer may primarily be focused on completing development tasks, but more senior engineers frequently spend a large chunk of their time focused on working with stakeholders to:
- Determine requirements
- Notify of upcoming data changes
- Communicate impacts
Each of these items can be aided with the help of ChatGPT. You can feed all your notes into ChatGPT and instruct it to create communications to share with internal business stakeholders. In the case of communicating the impact of a data change, you can even feed in a CSV of the expected impact. ChatGPT will summarize the data and provide highlights in the output.
ChatGPT is not at a stage where it can handle these communications unmonitored. You need to review the communications it recommends and likely make some edits, but editing an existing message can be much less intimidating than staring at a blank page.
5. Generating sample data
In recent years, I’ve put more emphasis on data quality and testing. This has been driven, in large part, by early morning calls notifying my that data has been incorrect for several days/weeks without anyone noticing until something downstream breaks or it starts impacting revenue. This is never a great way to find out about data quality issues which is why testing and data quality monitoring is so important.
My current company has a custom testing framework similar to the testing suite in something like DBT. You can specify input data and then what the resulting output data should look like. This can be a great way to test that your data transformations are working as intended. Even better, if you can incorporate this into your CI/CD process to ensure any change made passes these tests before pushing to production.
With as much benefit as this brings, I’ve had a hard time with adoption for both myself and others. The main problem is the time cost of setting these tests up. Input and output data needs to be created manually. Tests need to be generated. And even the table structure needs to be copied over.
Below is my code that I want to test.
WITH NEW_RECORDS AS (
SELECT
PRODUCT_ID,
PRODUCT_NAME,
PRODUCT_PRICE,
HASH(
PRODUCT_NAME,
PRODUCT_PRICE
) DATA_HASH
FROM NEW_PRODUCTS
)
MERGE INTO PRODUCTS P
USING NEW_PRODUCTS N
ON P.PRODUCT_ID = N.PRODUCT_ID
AND P.DATA_HASH = N.DATA_HASH
WHEN NOT MATCHED
INSERT (
PRODUCT_ID,
PRODUCT_NAME,
PRODUCT_PRICE,
CREATE_TS
) VALUES (
N.PRODUCT_ID,
N.PRODUCT_NAME,
N.PRODUCT_PRICE,
CURRENT_TIMESTAMP()
)
I can simply feed this into ChatGPT and get a whole suite of tests along with sample data created in seconds
ChatGPT answer:
To test the MERGE statement, we’ll create a few scenarios with sample input and expected output data. Here’s how you can structure your tests:
Assumptions:
PRODUCTSTable: The existing table where products are stored.NEW_PRODUCTSTable: The new data you want to merge into thePRODUCTStable.CREATE_TS: Timestamp when a new record is inserted.
Sample Schema:
CREATE TABLE PRODUCTS (
PRODUCT_ID INT PRIMARY KEY,
PRODUCT_NAME VARCHAR(255),
PRODUCT_PRICE DECIMAL(10, 2),
DATA_HASH VARBINARY(32),
CREATE_TS TIMESTAMP
);
CREATE TABLE NEW_PRODUCTS (
PRODUCT_ID INT,
PRODUCT_NAME VARCHAR(255),
PRODUCT_PRICE DECIMAL(10, 2)
);
Test Cases
Test Case 1: New Record is Inserted
-
Input (
NEW_PRODUCTSTable):INSERT INTO NEW_PRODUCTS (PRODUCT_ID, PRODUCT_NAME, PRODUCT_PRICE) VALUES (1, 'Product A', 10.00); -
PRODUCTSTable BeforeMERGE:-- Empty Table -
Expected Output (
PRODUCTSTable AfterMERGE):PRODUCT_ID | PRODUCT_NAME | PRODUCT_PRICE | DATA_HASH | CREATE_TS ---------------------------------------------------------------------------------------------- 1 | Product A | 10.00 | <calculated hash of Product A, 10.00> | <current timestamp>
Test Case 2: Existing Record with Different Data (No Insert)
-
Input (
NEW_PRODUCTSTable):INSERT INTO NEW_PRODUCTS (PRODUCT_ID, PRODUCT_NAME, PRODUCT_PRICE) VALUES (1, 'Product A', 15.00); -
PRODUCTSTable BeforeMERGE:INSERT INTO PRODUCTS (PRODUCT_ID, PRODUCT_NAME, PRODUCT_PRICE, DATA_HASH, CREATE_TS) VALUES (1, 'Product A', 10.00, <calculated hash of Product A, 10.00>, '2024-01-01 00:00:00'); -
Expected Output (
PRODUCTSTable AfterMERGE):PRODUCT_ID | PRODUCT_NAME | PRODUCT_PRICE | DATA_HASH | CREATE_TS ---------------------------------------------------------------------------------------------- 1 | Product A | 10.00 | <calculated hash of Product A, 10.00> | 2024-01-01 00:00:00
Test Case 3: Existing Record with Same Data (No Insert)
-
Input (
NEW_PRODUCTSTable):INSERT INTO NEW_PRODUCTS (PRODUCT_ID, PRODUCT_NAME, PRODUCT_PRICE) VALUES (1, 'Product A', 10.00); -
PRODUCTSTable BeforeMERGE:INSERT INTO PRODUCTS (PRODUCT_ID, PRODUCT_NAME, PRODUCT_PRICE, DATA_HASH, CREATE_TS) VALUES (1, 'Product A', 10.00, <calculated hash of Product A, 10.00>, '2024-01-01 00:00:00'); -
Expected Output (
PRODUCTSTable AfterMERGE):PRODUCT_ID | PRODUCT_NAME | PRODUCT_PRICE | DATA_HASH | CREATE_TS ---------------------------------------------------------------------------------------------- 1 | Product A | 10.00 | <calculated hash of Product A, 10.00> | 2024-01-01 00:00:00
Test Case 4: Multiple New Records Inserted
-
Input (
NEW_PRODUCTSTable):INSERT INTO NEW_PRODUCTS (PRODUCT_ID, PRODUCT_NAME, PRODUCT_PRICE) VALUES (2, 'Product B', 20.00), (3, 'Product C', 30.00); -
PRODUCTSTable BeforeMERGE:INSERT INTO PRODUCTS (PRODUCT_ID, PRODUCT_NAME, PRODUCT_PRICE, DATA_HASH, CREATE_TS) VALUES (1, 'Product A', 10.00, <calculated hash of Product A, 10.00>, '2024-01-01 00:00:00'); -
Expected Output (
PRODUCTSTable AfterMERGE):PRODUCT_ID | PRODUCT_NAME | PRODUCT_PRICE | DATA_HASH | CREATE_TS ---------------------------------------------------------------------------------------------- 1 | Product A | 10.00 | <calculated hash of Product A, 10.00> | 2024-01-01 00:00:00 2 | Product B | 20.00 | <calculated hash of Product B, 20.00> | <current timestamp> 3 | Product C | 30.00 | <calculated hash of Product C, 30.00> | <current timestamp>
SQL Code to Run the Tests
-- Clear Tables
TRUNCATE TABLE PRODUCTS;
TRUNCATE TABLE NEW_PRODUCTS;
-- Test Case 1: New Record is Inserted
INSERT INTO NEW_PRODUCTS (PRODUCT_ID, PRODUCT_NAME, PRODUCT_PRICE)
VALUES (1, 'Product A', 10.00);
-- Run the MERGE statement
MERGE INTO PRODUCTS P
USING (SELECT PRODUCT_ID, PRODUCT_NAME, PRODUCT_PRICE, HASH(PRODUCT_NAME, PRODUCT_PRICE) AS DATA_HASH FROM NEW_PRODUCTS) N
ON P.PRODUCT_ID = N.PRODUCT_ID
AND P.DATA_HASH = N.DATA_HASH
WHEN NOT MATCHED
INSERT (PRODUCT_ID, PRODUCT_NAME, PRODUCT_PRICE, CREATE_TS)
VALUES (N.PRODUCT_ID, N.PRODUCT_NAME, N.PRODUCT_PRICE, CURRENT_TIMESTAMP());
-- Check the PRODUCTS table for expected results
-- Test Case 2: Existing Record with Different Data (No Insert)
INSERT INTO PRODUCTS (PRODUCT_ID, PRODUCT_NAME, PRODUCT_PRICE, DATA_HASH, CREATE_TS)
VALUES (1, 'Product A', 10.00, HASH('Product A', 10.00), '2024-01-01 00:00:00');
INSERT INTO NEW_PRODUCTS (PRODUCT_ID, PRODUCT_NAME, PRODUCT_PRICE)
VALUES (1, 'Product A', 15.00);
-- Run the MERGE statement again and check the PRODUCTS table
-- Test Case 3: Existing Record with Same Data (No Insert)
INSERT INTO NEW_PRODUCTS (PRODUCT_ID, PRODUCT_NAME, PRODUCT_PRICE)
VALUES (1, 'Product A', 10.00);
-- Run the MERGE statement again and check the PRODUCTS table
-- Test Case 4: Multiple New Records Inserted
INSERT INTO NEW_PRODUCTS (PRODUCT_ID, PRODUCT_NAME, PRODUCT_PRICE)
VALUES (2, 'Product B', 20.00), (3, 'Product C', 30.00);
-- Run the MERGE statement again and check the PRODUCTS table
How to Verify:
- Row Counts: Ensure the number of rows in
PRODUCTSmatches the expected number after each test. - Data Integrity: Verify that the data in the
PRODUCTStable matches the expected output after each test. - No Duplicates: Ensure no duplicate
PRODUCT_IDvalues exist in thePRODUCTStable.
By running these tests, you can ensure that the MERGE statement is working correctly under different scenarios.
6. Debugging assistance
When you receive an error message, chances are high that this error message has been seen before. Previously, this was a huge role of StackOverflow. You could Google almost any error message and one of the first links would inevitably be StackOverflow.
Now, in the world of ChatGPT, you can more efficiently copy and paste the error message into ChatGPT. The more context you can provide, the better. ChatGPT will likely be able to determine the cause of the issue and point you in the right direction. If it has access to your code, it can event completely rewrite your code to fix the issue.
7. Career coaching
This point is not specific to data engineering, but I have found it to be one of the more compelling generative AI use cases I have come across. Oftentimes, we can be pretty aimless in our careers. Day-to-day it can be difficult to take a step back and come to a deliberate decision about what direction to take your career.
ChatGPT can serve as a sounding board to achieve your career goals, or even determine what those career goals should be based on your particular interest and priorities.
8. Generating common ETL pattern code
Most ETL patterns we write as data engineers are not unique. This is why tools like DBT or SQLMesh flourish. They abstract several common ETL patterns and allow engineers to focus on the parts of their ETL pipeline that are specific to their situation. For those without access to DBT or SQLMesh, ChatGPT provides a viable alternative to this.
Because these ETL patterns are so common, ChatGPT has been trained 100s of times on each of them. For example, if you want to generate a SQL script to upsert data into a table, just feed your table structure into ChatGPT and it can handle the rest.
9. Formatting code
There are already many tools to format code, but ChatGPT can be a quick effective alternative. Not only can it format the code, but it can even explain why it formatted the code in the way it did. Additionally, you can instruct using natural language to customize the way it formats code to match your standards.
10. Reviewing code
The last suggestion on this list is using ChatGPT to review your code. ChatGPT is not going to replace all of your code reviews, but it can be an initial step on your PR checklist to catch glaring issues before bringing it up to other team members.
As a simple example focusing more on syntax issues, we can feed the following SQL into ChatGPT
CREAT TABLE employees (
emp_id INT PRIMARY KEY,
first_name VARCHAR(50),
last_name VARCHAR(50),
hire_date DAE,
salary DECIMAL(10, 2
department_id INT
);
INSERT INTO employees (emp_id, first_name, last_name, hire_date, salary, department_id)
VALUES
(1 'John' 'Doe', '2023-07-01', 50000, 101),
(2, 'Jane', 'Smith', '2023-08-01', 'fifty thousand', 102);
SELECT * FRM employes;
UPDATE employees
SET salry = 55000
WHERE emp_id = 1;
CREATE INDEX idx_emp_name ON employees (first_name, last_nme);
DELETE FROM employees;
ChatGPT successfully identifies these syntax and naming conventions issues and also provides caution about some best practices
ChatGPT answer:
Here’s a review of the SQL code with corrections and explanations:
Issues and Corrections:
- Table Creation Syntax Errors:
- CREAT should be CREATE.
- DAE should be DATE.
- There is a missing closing parenthesis after the
salarycolumn definition. - A comma is missing between the
salaryanddepartment_idcolumns.
Corrected Code:
CREATE TABLE employees ( emp_id INT PRIMARY KEY, first_name VARCHAR(50), last_name VARCHAR(50), hire_date DATE, salary DECIMAL(10, 2), department_id INT ); - INSERT Statement Issues:
- Missing a comma between the values for
emp_idandfirst_namein the first row. - The value
'fifty thousand'is a string, which should be a numeric value for thesalarycolumn.
Corrected Code:
INSERT INTO employees (emp_id, first_name, last_name, hire_date, salary, department_id) VALUES (1, 'John', 'Doe', '2023-07-01', 50000, 101), (2, 'Jane', 'Smith', '2023-08-01', 50000, 102); - Missing a comma between the values for
- SELECT Statement Errors:
- FRM should be FROM.
- employes should be employees.
Corrected Code:
SELECT * FROM employees; - UPDATE Statement Errors:
- salry should be salary.
Corrected Code:
UPDATE employees SET salary = 55000 WHERE emp_id = 1; - CREATE INDEX Statement:
- last_nme should be last_name.
Corrected Code:
CREATE INDEX idx_emp_name ON employees (first_name, last_name); - DELETE Statement:
- The
DELETEstatement is correct but be cautious when executing aDELETEwithout aWHEREclause, as it will delete all records in the table.
Consider adding a condition:
DELETE FROM employees WHERE emp_id = 1; - The
Summary of Corrected Code:
CREATE TABLE employees (
emp_id INT PRIMARY KEY,
first_name VARCHAR(50),
last_name VARCHAR(50),
hire_date DATE,
salary DECIMAL(10, 2),
department_id INT
);
INSERT INTO employees (emp_id, first_name, last_name, hire_date, salary, department_id)
VALUES
(1, 'John', 'Doe', '2023-07-01', 50000, 101),
(2, 'Jane', 'Smith', '2023-08-01', 50000, 102);
SELECT * FROM employees;
UPDATE employees
SET salary = 55000
WHERE emp_id = 1;
CREATE INDEX idx_emp_name ON employees (first_name, last_name);
DELETE FROM employees WHERE emp_id = 1;
This corrected code should now execute without errors.
Conclusion
As you can see, ChatGPT and other generative AI tools offer numerous advantages for data engineers, from generating initial drafts of complex SQL scripts and API connectors to assisting with debugging and providing career coaching. While these tools are not yet perfect and require human oversight, they significantly reduce the time and effort required for many common tasks, allowing data engineers to focus more on strategic and creative aspects of their work.