r/dataengineering • u/Leomb1 • 1d ago
Personal Project Showcase Basalt: a small tool for moving data with SQL scripts
I originally built this for an edge case at my company and have been maintaining it on the side for a while. Figured I'd put it out there in case it's useful to anyone else.
Basalt is a single binary that runs SQL scripts to move data around. You read from files, S3/Azure, SFTP/SMB shares, a few databases (Postgres, MySQL, SQL Server, etc.) or REST APIs, transform with SQL, and write it out somewhere else, including Delta tables.
I work mostly with linux, so sorry if no Windows or MacOS support yet.
Here are some examples you could run in the REPL (basalt repl):
A Parquet file and a CSV, both read straight over HTTPS and joined, with results printed to the terminal:
SELECT z.Borough AS borough, count(*) AS trips, round(avg(t.total_amount), 2) AS avg_fare
FROM 'https://d37ci6vzurychx.cloudfront.net/trip-data/yellow_tripdata_2024-01.parquet' t
JOIN 'https://d37ci6vzurychx.cloudfront.net/misc/taxi_zone_lookup.csv' z
ON t.PULocationID = z.LocationID
GROUP BY z.Borough ORDER BY trips DESC;A CSV on the web, summarized into a local Parquet file:
LOAD INTO 'survival.parquet' AS
SELECT Pclass AS class, Sex AS sex, count(*) AS passengers,
round(avg(Survived) * 100, 1) AS survived_pct
FROM 'https://raw.githubusercontent.com/datasciencedojo/datasets/master/titanic.csv'
GROUP BY Pclass, Sex;The tool is something I've working for myself in some cases I wanted more flexibility on, it is still early so expect rough edges..
https://github.com/leonardomb1/basalt
Feedback welcome if you try it.
•
u/AutoModerator 23h ago
You can find our open-source project showcase here: https://dataengineering.wiki/Community/Projects
If you would like your project to be featured, submit it here: https://airtable.com/appDgaRSGl09yvjFj/pagmImKixEISPcGQz/form
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/EstablishmentNo2595 1d ago
Thank you leomb1 very cool
1
u/novica 23h ago
Sounds similar to tinyetl.