In my previous post I mentioned that I started using Obsidian for organizing my notes and blogs, and that I wanted to go back through my archive and refresh my older posts and start maintaining my writing more carefully. At first I was planning on copy pasting my way through this task...every time I wrote a new post would pull down an old one, edit it, and republish it. After thinking about it for a minute I realized that it would probably be easier to write a quick migration script.
This isn't going to be a heavy hitting technical post, obviously, just a fun thing to write about while I think through it. This is going to bring together a few of the ideas I've been writing about lately, python vs c#, AI (vibe coding?), and writing better.
Recent projects at work have given me the opportunity to delve into Python a lot more so I'm probably going to go with that again here. I like how easy it is to do text and data manipulation, I'm having fun learning it so far, and even though I'm not super familiar with the syntax I can use an LLM for assistance and bridge the gap.
I know my blog posts are stored in a SQL DB, I'm hoping it's a simple flat table containing markdown that I can walk through and write to files on my hdd.
Obsidian is working with .md
files under the hood so nothing to worry about there.
Plan
Questions
Because it's late and this is a simple task I'm going to lean on copilot for this, I'm going to prompt it with my initial thoughts and a JSON example of a blog post from the DB and see how that goes.
The Blogs are not in a flat table, they are stored as JSON documents in a Documents table, so I'll need to filter them out and then parse the JSON.
My dev machine isn't as well equipped for python work as my work machine, I refuse to turn on my work laptop on a weekend, so this is a bummer. Fortunately I had an espresso earlier this evening. 🍵
Okay, got everything installed and all of my markdown files have been downloaded. Going to do this in C# just for fun now.
Okay C# version is done
Once I got my dev env setup it took about 10 minutes for my extremely tired brain to talk github copilot through the simple python script. I estimate that at my level of python knowledge without copilot this would have taken me an hour or two, and there's no way I would have attempted it after midnight.
On the other hand, surprisingly, it took longer to "vibe code" my way to a C# solution, in fact in the end I got frustrated and dumped the python solution into copilot and said, "this, but in C#" to get it to generate the results I wanted. For example, if you say JSON most .net developers think Newtonsoft but the first attempt by copilot didn't import any parsing library.
I've always suspected that LLMs are a little bit better at writing python than other languages since that's one of the things they focus training on, so that's something to keep in mind. Also, as an experienced C# developer it was kind of painful to watch copilot struggle, especially after breezing through the python solution.
Still, I think it's pretty amazing that with many years of C# experience and 0 years of python experience I can use python + copilot to produce a solution in about the same amount of time.