Author: way0utwest

  • Is Your Deployment Process Perfect?

    I’m sure your deployments aren’t perfect. I’ve had many successful ones, but I have always found some flaws in my systems over time. I’ve also found that the less flexibility I allow, the more likely things are to succeed.

    However less flexibility isn’t what most companies or clients want. In fact, they want the opposite. I know most developers want this as well, without constraints on what they can do.

    I think Redgate has been working to make things easier and more reliable for most companies. Certainly we have work to do and there are places to improve our products, but our DLM work on various products is really designed to reduce, or eliminate, silly mistakes that cause issues. We’ve tried to help companies set up a process that limits regression issues.

    I saw this short video from Redgate, where the lead Data Anlyst at Yorkshire Water talks about some of the improvements in their development process come about by implementing a DLM process. Over a couple of years, they’ve gotten many of their projects into a Continuous Delivery stack and that’s just the way they do things.

    Yorkshire Water

    The time savings are the big issues. There is less copying of production data around, more confidence in development, and as Shaun notes, time is money.

    If you think you want to build a more repeatable, reliable database development process, I think we give you a few options. The traditional, work in SSMS approach with SQL Source Control, or our Ready Roll work in Visual Studio. I’m particularly excited about Ready Roll as that’s how I’ve done a lot of development in the past.

    And, of course, I think our DLM Automation suite, allowing you to deploy changes to a CI environment and build deployment packages works well.

  • Multiple CTEs – #SQLNewBlogger

    Another post for me that is simple and hopefully serves as an example for people trying to get blogging as#SQLNewBloggers.

    One of the techniques that I find very handy in solving SQL problems is the CTE. This is much easier to read, for me, than embedding code into a derived table. For example, which of these is easier to decode, or perhaps more importantly, debug?

    WITH calendarquarters (qtr, yr, dt)
    AS
    ( SELECT qty = ‘Quarter ‘ + CAST(c.QtrNum AS VARCHAR(3))
           , yr = ‘Our year ‘ + CAST(YEAR(c.CalDate) AS VARCHAR(4))
           , c.CalDate
       FROM dbo.Calendar AS c
    )
    SELECT *
    FROM calendarquarters cq
    INNER JOIN dbo.CustomerSales AS s
      ON cq.dt = s.LastSale

    Or this:

    SELECT *
    FROM (  SELECT qty = ‘Quarter ‘ + CAST(c.QtrNum AS VARCHAR(3))
           , yr = ‘Our year ‘ + CAST(YEAR(c.CalDate) AS VARCHAR(4))
           , dt = c.CalDate
       FROM dbo.Calendar AS c
    ) cq
    INNER JOIN dbo.CustomerSales AS s
      ON cq.dt = s.LastSale

    I’d argue the first becomes easier, especially when I have multiple tables in the join. In this way I can more easily see in the first example I’m joining two tables/views/CTEs together. If I want to know more about the details of one of those items, I can easily look up and see the CTE at the beginning.

    However when I want multiple CTEs, how does this work?

    That’s pretty easy. It’s actually just listing each CTE, separated by commas. In my case, I wanted to do this:

    with upcte

    as

    (select uplen = len(replace(floorstring,’)’,’’)

    from Day1

    )

    , downcte

    as

    (select downlen = len(replace(floorstring,’(’,’’)

    from Day1

    )

    select uplen – downlen

    from upcte, downcte

    That’s it. I use the WITH once, and then each CTE stands along. I could add the column names if I wanted, but here I can easily see I’m querying two numbers from two “tables”, CTEs in this case, and performing subtraction. If I want the details, I get that from the previous definitions.

    SQLNewBlogger

    A quick post as I used this technique in solving Day 1 of the Advent of Code. This took about 5 minutes to write, and I got to add my own twist to the concept.

    References

    A quick one from my first Google result. While I knew how to do this, I double checked myself with a search.

    Multiple CTE in One Select Statement Query – http://blog.sqlauthority.com/2009/08/08/sql-server-multiple-cte-in-one-select-statement-query/

  • Hacking to Hide

    It’s probably no surprise to you that the black boxes for ships are vulnerable to hacking. These are the Voyage Data Recorders (VDR) that should capture telemetry, audio recordings, and more. These devices are really computers now, connected to the onboard networks used for satellite communications and physically accessible in many vessels.

    It was surprising to hear that some of these VDRs are running Windows XP. While I get that there is some ease of development in using Window systems, that OS wasn’t what I’d call robust and stable for stressful and rugged environments. Some systems use real time OSes, which seems like a better compromise, but Linux might be the best choice for a system both tolerant to a variety of conditions as well as one that might be easy to build applications for.

    However no matter what the choice, I’d hope that the developers building software for these systems would treat them with the importance they deserve. While lives aren’t at stake from these applications, liability is. These systems are used in legal proceedings, so the data they collect, in an autonomous fashion, should be protected to ensure its integrity.

    Apparently that doesn’t happen, as there are incidents of these devices being hacked an data erased, corrupted, interrupted, or even accessed by those on the ships. That’s not surprising as it seems people always find ways to take advantage of the computer systems they physically control. Ultimately I’d hope that we might constantly transmit some of this data off the ship to ensure there are backup copies, but that brings to mind the problems of securing data in transit, preventing access or disclosure and more.

    However these systems might provide a good testbed for researchers looking to better build and architect auditing systems. This is a challenging environment, with high stakes, and if we can develop ways to ensure auditing data is intact when we have lost physical control of the device for long periods of time, perhaps we can find ways to build this same auditing into other platforms.

    Steve Jones

    The Voice of the DBA Podcast

    Listen to the MP3 Audio ( 2.4MB) podcast or subscribe to the feed at iTunes and LibSyn. feed

  • Back to Work

    It’s strange to be back to work on a Monday, with kids still in the house (they start school tomorrow), after being gone for the last 10 days  from work. It was really gone, as I didn’t process email or mess with work in any meaningful way. I did clean some spam over vacation when others were gone, and I added a few Database Weekly links last week, but I didn’t check SQLServerCentral, edit articles, or do anything really SQL related.

    About the only computer tasks I’ve done since the day before Christmas were a few hours on the Advent of Code stuff I’ve been working on in my spare time, and even that was minimal. I got stuck on a few puzzles, and didn’t have much time to work through them. I’d give it 20-30 minutes, but then break for family time.

    It’s a new year, and I’m starting slow. At least slow this week as I take stock of the publishing queues and start to plan how I’ll proceed forward. As I left last year, there were a lot of new technologies coming from Microsoft in 2016 that I felt I needed to get up to speed on. Some are out, some coming, but they’re a point of emphasis. Like Buck Woody with his Data Scientist work, and Grant Fritchey with R, I’m proceeding to learn more about analytics, including data lakes and statistics, as I move through the year. Particularly I’m focused on Python as the language to use, though from what I see with R, lots of the same libraries and formulas apply.

    I’m also looking to continue forward with the #SQLNewBlogger posts and see if I can inspire some of you to move forward with your own skills and thoughts on how SQL works for you. I’m going to look to get at least 2 posts a month out here, and perhaps more.

    Travel starts quickly, with a week long trip to the UK in two weeks and then SQL Saturday Austin, but other than that, it will be a light quarter for me. Just one event in Feb, and none in March. I am looking forward to that slow beginning.