Category: Blog

  • Working with Neo4j Imports–I HATE CASE SENSITIVITY

    I’ve been working to better understand graph databases and where they can be useful.

    There is a file from Neo4J that comes with the Desktop and contains a data export from Northwind. This looks like this when you open it:

    2022-08-02 16_24_48-employees.csv - Excel

    On the page where Neo4j talks about the employee imports, they have this code:

    // Create employees
    LOAD CSV WITH HEADERS FROM 'https://gist.githubusercontent.com/jexp/054bc6baf36604061bf407aa8cd08608/raw/8bdd36dfc88381995e6823ff3f419b5a0cb8ac4f/employees.csv' AS row
    MERGE (e:Employee {employeeID:row.EmployeeID})
       ON CREATE SET e.firstName = row.FirstName, e.lastName = row.LastName, e.title = row.Title;

    This loads fine.

    When I run this code, it works. When change to this, it fails. It’s erroring out on my file. I tried moving the file, removing nulls, etc.

    LOAD CSV WITH HEADERS FROM 'file:///employees.csv' AS row

    MERGE (e:Employee {employeeID:row.EmployeeID})

    ON CREATE SET e.firstName = row.FirstName, e.lastName = row.LastName, e.title = row.Title;

    Here’s the error in the Neo4j Browser:

    2022-08-02 16_35_03-neo4j@bolt___localhost_7687_neo4j - Neo4j Browser

    I kept editing the file and trying different things. I compared what I had locally with what was on GitHub. Eventually, I realized this is the issue:

    {employeeID:row.EmployeeID}

    In the GitHub csv, the first row has headers with EmployeeID. In my local file, the header is “employeeID” (lower case). As soon as I edited this, it worked.

    THIS IS THE FILE THAT CAME WITH NEO4J DESKTOP.

    They make mistakes, just like I do. I hate that there are too many things like that that are care sensitive. I get that sometimes you want data to be in a particular format, but I think in the modern world, making metadata case sensitive isn’t productive.

  • Daily Coping 8 Aug 2022

    I started to add a daily coping tip to the SQLServerCentral newsletter and to the Community Circle, which is helping me deal with the issues in the world. I’m adding my responses for each day here. All my coping tips are under this tag.

    Today’s tip is to set an intention to be kind to others and yourself this week.

    This week I’m traveling to Redmond and Los Angeles. I will encounter service people in restaurants, drivers for taxis, airport workers, and many attendees at events. My wife is also going to LA with me to enjoy a weekend together after SQL Saturday Los Angeles 2022.

    I am making a conscious effort today to be kind to others, let small things go, be empathetic and understanding. I’m also going to remember that this will be extra time and stress out of my week and I need to ensure I eat well, find some time to exercise, and relax when I can.

  • Driving Costs With a Tesla Compared to Gas

    This is part of a series that covers my experience with a Tesla Model Y.

    I wrote recently about the costs for me to charge at a Supercharger. The USD$0.43 was higher than I expected, but lower than the USD$0.58 I’ve seen some CA people post about.

    With the intricate linkages of the World Wide Web, I’ve seen a few articles lately about charging. First, there was a debunking of a meme at Jalopnik, which I thought was crazy. Especially since I own a horse trailer. Then there was a user posting at Reddit that ended up poorly shared on Autoevolution. For the record, I find that site have poor journalism standards.

    I also caught a post on Facebook about new public electric chargers coming to Colorado and was amused by all the comments about the grid failing and not being able to handle things and how expensive and poor for the environment electric cars are.

    A lot of hype and silliness, or FUD, from lots of non electric positive people. However, I wanted to check on the real costs for me. So I got some of my data.

    Comparing Costs

    I still have a 2012 BMW X5. I was thinking to replace it with something similar when we got the Tesla. So purchase costs are out for me, but I did decide to compare the cost of operating that car with the Tesla. I also decided to add a Prius in. Now, our old Prius would get around 47-48 in the summer, 43-44 in the winter. This car was rated at 50mpg. A newer one, like the Prime, is rated at 54, so I’ll use these values for my MPG:

    • BMW – 22
    • Prius 50

    I also compared the cost of home charging v Supercharging. My experience recently is these costs:

    • Home – $0.14
    • Supercharging $0.43

    I have solar, but since I just use power, if I spend it charging the car, I pull more from the grid, so I’ll leave that cost the same.

    Trips

    I run Teslamate, which logs all my drives. I can see the distances and power usage for each trip. As you see below, there is a lot of data.

    2022-07-27 10_25_50-Drives - Grafana — Mozilla Firefox

    I grabbed a sampling of trips, long and short, around town and into the mountains. The gas cars do worse in the mountains, as does the Tesla, but rather than try to make things complex, I left the same MPG for the gas cars.

    Methodology

    • For a particular trip, I get the mileage and kWh used. I can multiple kWh by cost and get a simple cost for electricity in two ways: home and Supercharging. This isn’t my actual cost, but hypothetical if all my charging were in one of these two places. As an example, for a 20.2mi trip, I get:
    • home cost –  $0.56
    • Supercharger cost – $1.72

    For the gas cars, I divide the miles by mpg. This gives me gallons used. For that 20mi trip is just under a gallon for the BMW and under half a gallon for the Prius. I then multply by the gas cost. I set that at $4.30 for now. It’s been higher lately, but I paid that last week on a trip to the airport (I took the BMW).

    I put a set of 11 random trips in a spreadsheet and compared things. This is what I see:

    2022-07-27 10_30_21-Book1 - Excel

    For my 2o mile trip, I see these costs:

    • Home: $0.56
    • Supercharging: $1.72
    • BMW: $3.95
    • Prius: $1.74

    For a longer trip in the mountains, 55mi, I see:

      • Home: $2.03
      • Supercharging: $6.24
      • BMW: $10.81
      • Prius: $4.76

    The aggregates for 418.8 miles (this sample) are:

    • Home: $15.76
    • Supercharging: $48.42
    • BMW: $81.86
    • Prius: $36.02

    Clearly the Tesla is a lot cheaper if I charge at home. My power costs are mostly fixed, though the Supercharger can be cheaper than $0.43. It could be more expensive, but I haven’t seen that. Gas certainly goes up and down and even at $4, home charging is cheapest.

    The Prius looks good in a bunch of places compared to Supercharging. I had 4 of those 55mi trips in the mountains, all on Supercharger charging, but I also know the Prius would not be getting 50mpg there. Probably more in the 25-ish range. Mountains are steep.

    My Experiences

    I’ve owned lots of cars. My experiences in the last year, in looking at data and comparing to the Prius, BMW, RAM 3500, and other cars, is that the Tesla is a lot less expensive to operate. My back of the napkin thoughts before this were the Tesla is about 1/2 of the Prius cost and 20-25% of the BMW to operate.

    You can make all sorts of comparisons on ROI and costs, and you should. For your situation. For me, given my life and choices, this was a great purchase. I’d have spent $45-50k anyway on a car, so the purchase wasn’t something I calculated in. I also carry 5 adults at times and that wasn’t very comfortable in the Prius. The BMW worked fine, as does the Tesla.

    Charging isn’t simple, and while I got a wall charger + installation for US$760, I would not be surprised if a lot of people paid closer to $1500. However, it’s not a crazy cost, and it’s essentially adding another circuit for your clothes dryer. A good portion of us can do this, and then we have a “full tank of fuel” every morning. That alone is a very neat experience.

    I think Tesla is great. If we needed another car, we’d look at Polestar, Hyundai, Rivian, and a few others. I’m sold on them as an every day car that is relatively cheap to operate. We’ll always have the diesel pickup for towing and trips if we need it, but having owned different types of cars, the electric paradigm makes a lot of sense.

    And if we really wanted a car for a trip and worried about charging, like through Montana, we’d just rent a car. We’ve done that in the past to save wear and tear, and it’s hard enough to find fuel in Montana and Wyoming at times. A rental would be an easy choice, so range anxiety isn’t a problem. If I have it, I get rid of it for that trip. Not for the rest of my life.

  • Daily Coping 5 Aug 2022

    I started to add a daily coping tip to the SQLServerCentral newsletter and to the Community Circle, which is helping me deal with the issues in the world. I’m adding my responses for each day here. All my coping tips are under this tag.

    Today’s tip is to be a realistic optimist. Focus on what could go right.

    I find a lot of people think ahead and get concerned about the downsides. What could go wrong? They find reasons to not do something.

    Of course, there are others that a few that leap first and worry about issues later.

    I tend to be in the first group, though I’ve learned to recognize when I’m not being optimistic, when I am letting fear drive me. That has helped me to have confidence in most things going right.

    Which they do. Most of the time things work out fairly well.

    I’m trying to do this with SQL Saturday. I’m hopeful for the future and events, and understanding when people are hesitant. However, I am confident that more organizers will run events and more people will want to come to live in-person events.

    I’m being optimistic, knowing that this doesn’t apply to everyone and I have empathy for the reality.