Author: way0utwest

  • A New Word: the whipgraft delusion

    whipgraft delusion – n. the phenomenon in which you catch your reflection in the mirror and get the sense that you’re peering into the eyes of a strange, as if you’re looking at a police sketch of your own face aged forward twenty years, which would imply the real you is out there somewhere, wandering the streets of your old neighborhood, still at large.

    Twenty years? More like thirty.

    I thought about this as I don’t really look at myself in the mirror often.I certainly see myself, putting in contacts, brushing teeth, shaving, but I don’t often look closely.

    However, once in awhile I’ll look at myself and while I don’t always mentally feel or act my age, I don’t feel this old. However, if I look closely, I realize I look old. As old as my knees and back feel some days. Definitely some whipgraft delusion.

    From the Dictionary of Obscure Sorrows

  • Creating a Scripts Folder in SQL Compare

    While I was at a conference recently, someone asked me about the Scripts Folder feature in SQL Compare and how to set that up. This post just looks at how to get SQL Compare to set up a Scripts folder on a machine.

    This is a part of a series of posts on SQL Compare on my blog. You can read other posts I’ve written by clicking the link.

    Getting Started

    I’ve got a D: drive on my machine that looks like this.

    2023-11-20 14_34_40-SanDisk500 (D_)

    I’m going to create a folder, called “Compare Script Folders”, which you can see is empty. This is where I’ll store the scripts for various databases.

    2023-11-20 14_35_29-Compare Script Folders

    I also have a couple databases I use to test things on a local instance. You can see below my “compare1” database has a few things in it.

    2023-11-20 14_49_17-googlemaps.sql - ARISTOTLE_SQL2022.way0utwest_dev (ARISTOTLE_Steve (53))_ - Micr

    Now, I want to get a text copy of my schema from SQL Compare that I can use to check for changes, so let’s do that.

    Creating a Scripts Folder

    In order to create a scripts folder, I need to run SQL Compare. Once I do that, I see a screen like that shown below.

    2023-11-20 14_51_31-SQL Compare

    By default, SQL Compare looks to compare two databases. However, I can change the source. If I click the drop down next to Source, I see all of the options I have available. One of these is Scripts folder, which I’ll select.

    2023-11-20 14_51_41-(local)_SQL2017.SimpleTalk_1_Dev v localhost.SimpleTalk_1_Dev.scp

    Once I do this, my dialog changes. Now, I have the ability to compare a Scripts folder to a database. How do I get the Scripts folder? I click the Create link shown below.

    2023-11-20 14_51_49-(local)_SQL2017.SimpleTalk_1_Dev v localhost.SimpleTalk_1_Dev.scp_

    I missed this a few times, so that’s part of why I wrote this post. Once I click that, I get a new dialog. This is the one that let’s me choose the way I want to create the folder.

    2023-11-20 14_52_30-Create new scripts folder

    Just like the comparison, I have a number of choices for the source. I can use various items, but in my case, I’ll choose database.

    2023-11-20 14_52_02-(local)_SQL2017.SimpleTalk_1_Dev v localhost.SimpleTalk_1_Dev.scp_

    Once I do this, I enter the credentials to access the database. Note that I’ve clicked “Trust”, which is required for all modern versions of SQL Server. I have also selected the new folder I created.

    2023-11-20 14_52_30-Create new scripts folder

    Once I click Create, the engine will start to script out my database into separate files. This is the same process used when running a comparison, but in this case the results are just output to files rather than held in memory to compare with another set of objects.

    2023-11-20 14_52_38-Creating scripts folder - Completed

    Once the comparison completes, I see a new folder created below the folder that was in my dialog.

    2023-11-20 14_52_54-Compare Script Folders

    Inside this folder are all my objects, separated into different folders, which is the SQL Compare structure. This is the same structure used in SQL Source Control and Flyway.

    2023-11-20 14_53_09-Tables

    Now I can use this as the basis for a source or target against another source or target in SQL Compare.

    If you want to do this from the menu, there’s also an item in the File menu to get the Create Scripts folder dialog.

    2023-11-20 15_04_12-SQL Compare

    SQL Compare is a fantastic product for simplifying work and it does so much more than this. Give it a try if you own it or download an evaluation today.

  • AI In the Nov 2023 Enterprise

    AI is everywhere. I can’t seem to get away from stories on the technology in 2023, and while I don’t know that I’ve found it that helpful, I keep looking at it because it’s becoming a pervasive technology that most enterprises will experiment with in some way. There is a look at generative AI in the Enterprise in the O’Reilly Radar, which tracks how technology is changing and influencing the world.

    The report talks about most of the respondents to a survey using AI, which makes sense as the people responding likely have some interest in the technology. I always take these trends with a grain of salt as people who are busy and not interested might not respond. Only a small percentage of uninterested people will actually answer these things.

    As I look at the numbers with that in mind, I find it interesting that about half of the users think AI will lead to greater productivity and a small number (4%) think this means less headcount. However, only a minority (41%) have been using this for over a year. That likely means in most cases that people are experimenting like I am. This isn’t a pervasive technology in the enterprise, though I’d argue that while DevOps might be in use in most enterprises, I wonder if it’s in use in most projects at most enterprises. Culture change is hard for most people and I still meet lots of people who aren’t trying to get better at building software.

    The big challenge in many companies is finding appropriate business cases. I think that’s my struggle as well, in trying to think about how to use AI to write or build code, I struggle to think of how to prompt or what to prompt. Often by the time I define the problem, I can just write the code. If I were scaffolding out basic classes or tables, maybe I’d feel differently, but as our CTO put it, we spend most of our time figuring out the problem, not writing the code. There are legal concerns, but those are from a minority of respondents. I have a meeting with our legal department soon, which will help me iron out some of my concerns and get guidance.

    Interestingly, 77% of people are using AI in programming, with about half of those using it for work. I don’t know if we’ve done a good job understanding the IP/copyright issues here, so that’s surprising. I would guess in many organizations that don’t sell software, they don’t care about this at all. If they get code from an AI that was copied from somewhere else, if it works, who cares?

    I find that much of the code generated isn’t great. It’s junior developer level, which might not matter to many organizations. After all, they employ junior developers, and some employ senior developers with 6 months of experience 10-20 times over who write that level of code. If the AI does it faster, all the better.

    I think AI is a technology that is going to impact our lives as technical and data professionals. Whether you use it to write code or use it as a glorified search engine, it’s a tool that you want to understand and develop some skill with. Writing prompts and learning how to navigate an AI system is helpful. If it actually gives you something useful, even better. And if you learn more about building models and prompt engineering, you might find yourself with some interested opportunities in the future as I expect those jobs to grow in number across the next few years.

    Steve Jones

    Listen to the podcast at Libsyn, Spotify, or iTunes.

  • Migrations are Worth the Effort

    I work with a lot of customers that are trying to find better ways to build and deploy database code. Some of them use a state or model method with SQL Compare or another Redgate product, and some want to use Flyway and its hybrid migration-based framework. It’s always interesting to me how customers lean one way or the other, for various reasons.

    No matter which choice people make, we know that using migrations is more effort than a state-based approach. However, I think that it’s a better approach, especially because no matter how simple or smooth you think your development process is, at some time there will be a situation that needs a more complex approach. a migrations-based framework allows you to handle the complexity smoothly, without depending on a person to sort out the issues.

    It’s not just me, but many developers feel the same way. There’s an interesting article from a developer that gives some examples of why using migrations work well in different situations. It also acknowledges that the effort is high, but by using migrations you can accomplish complex tasks across time. something I try to get more developers to do. Don’t big-bang-deploy-everything, but break things into chunks.

    It’s not just a simple change. There are a few reasons that migrations are hard, one of which I loved. The author compares migrations to working with live electrical wires. Imagine hanging a ceiling lamp and wiring it up without turning off the power (note: don’t try that).

    One of the best reasons I have for migrations is that lots of work isn’t done at the same time, especially in a team. If each team or each piece of work is broken into separate migrations, choosing which ones to move over from developer is much easier than if all the changes are captured in a state-ful model. You still have to be aware of dependencies between migrations, but having them all separate at the beginning (and hopefully tagged to pieces of work) makes this easier.

    The other reason to choose migrations is that I can stage future changes. Imagine I need to make a change to add something in one migration and remove it later. Suppose we add a new tax column and then after Jan 1, we remove the old tax column. With migrations I can pre-write the removal and create a pull request with the “Tax Removal – DO NOT MERGE UNTIL 2024 JAN 1” title, which should be obvious to anyone. I like keeping things simple, which helps when I never know who might need to handle this work in the future.

    Steve Jones

    Listen to the podcast at Libsyn, Spotify, or iTunes.