Posts

Using Django with SQL Server LocalDB

How to use Django with SQL Server LocalDB

LocalDB is a version of Microsoft SQL Server Express Edition designed for developers. LocalDB is:

  • easy to install
  • requires no management
  • is compatible with other editions of SQL Server

LocalDB is also lightweight. The setup routine is just 45MB. LocalDB instances will start automatically upon the first connection request and stop automatically shortly after the last connection is closed.

Databases hosted on LocalDB are limited to 10 GB in size.

Follow these steps to install LocalDB, create a database, and connect Django.

Note: This post has been tested with Microsoft SQL Server 2017, Django 1.11.x and 2.x. The pyodbc and django-pyodbc-azure packages will be used to connect Django to SQL Server. The version of django-pyodbc-azure must match your version of Django.

Installing LocalDB

  1. Download SQL Server 2017 Express from https://www.microsoft.com/en-us/sql-server/sql-server-downloads.
  2. Run the setup routine and click Download Media.
  3. Choose LocalDB, specify a download location, and click Download.
  4. Click Close button to close the setup routine.
  5. Run the SqlLocalDB.msi setup routine.
  6. Click Next button.
  7. Accept the license agreement and click Next button.
  8. Click Install button.
  9. Click Finish button.
  10. Download most recent Cumulative Update for SQL Server 2017 (CU11 as of this post) from https://www.microsoft.com/en-us/download/details.aspx?id=56128 and run the setup routine.
  11. Accept the license agreement and click Next button.
  12. Click Next button on Features page.
  13. Click Next button on Check Files In Use page.
  14. Click Update button on Ready to update page.
  15. Click close button on Complete page.

Note: There is a bug in versions prior to CU6 that prevent databases from being created in the default location with LocalDB.

  1. Download Microsoft ODBC Driver 13.1 for SQL Server from https://www.microsoft.com/en-us/download/details.aspx?id=53339 and run the setup routine.

    Note: This is required for the Command Line Utilities for SQL Server
  2. Click Next button on Welcome page.
  3. Accept the license agreement and click Next button.
  4. Click Next button on Feature Selection page.
  5. Click Install button.
  6. Click Finish button.
  7. Download Microsoft Command Line Utilities 14.0 for SQL Server from https://www.microsoft.com/en-us/download/details.aspx?id=53591 and run the setup routine.
  8. Click Next button on Welcome page.
  9. Accept license agreement and click Next button.
  10. Click Install button.
  11. Click Finish button.

Creating database

LocalDB supports multiple instances. We recommend created a named instance for each Django project.

  1. Open command prompt as Administrator
  2. Create a named instance for your project (replace “Project” with the name of your project)
    sqllocaldb create ProjectLocalDB
    
  3. Start the new instance
    sqllocaldb start ProjectLocalDB
    
  4. Verify the instance is running
    sqllocaldb info ProjectLocalDB
    
  5. Connect to the named instance
    sqlcmd -S (LocalDB)\ProjectLocalDB
    
  6. Create login for new instance
    create login my_user with password='my_password'
    go
    
  7. Assign login to the admin role
    sp_addsrvrolemember my_user, sysadmin
    go
    
  8. Create user
    create user my_user
    go
    
  9. Create database
    create database my_db
    go
    exit
    

Configure Django to connect to LocalDB database

  1. Install Django dependencies for connecting to SQL Server
    pip install pyodbc
    pip install django-pyodbc-azure
    

    Note: The version of django-pyodbc-azure must match your version of Django.

  2. Update DATABASES settings in your Django application
    DATABASES = {
        'default': {
            'ENGINE': 'sql_server.pyodbc',
            'HOST': '(LocalDB)\ProjectLocalDB',
            'PORT': '',
            'NAME': 'my_db',
            'USER': 'my_user',
            'PASSWORD': 'my_password',
            'OPTIONS': {
                'driver': 'ODBC Driver 13 for SQL Server',
            },
        },
    }
    

Note: Django will connect to a SQL Server database with ODBC Driver 11, 13, and 17, but version 13 is required for the sqlcmd utility included in Command Line Utilities 14.

 

Small Business IT Consulting Services: 5 Questions to Ask

Small business has increasingly become dependent on technology. In fact, we often say,

“Every business is a technology business.”

When it comes to small business technical support, you often can’t afford to hire full-time IT staff – and even if you do have one IT professional – that one individual doesn’t always have all the skills needed to keep business operations running efficiently.

Evaluating Small Business IT Consulting Services

When hiring an IT Services company, here are 5 questions that can help you get the best fit for your company’s needs.

1. How will you be billed?

IT service company consulting fees vary based on the billing model. Common models include:

Managed Services – You pay one set price per month, and in return, your computer network is kept running smoothly. This model provides predicable income for the service provider and a budget-able expense for an organization. The challenge is gaining clarity what’s within scope of the set fees.

Set Price Services – Some IT service providers offer set fees, similar to getting an oil change on your car. This pricing model works well for small, discrete jobs.

Time & Expense Services – This billing model allows you to fluctuate your IT expenditures based on cash flow and the intensity of your current IT initiatives

However, you are billed, a good IT services provider will help you find the resolution to the problem but can’t always resolve the problem.

  1. The problem may not be worth fixing. It may be easier and less expensive to buy a computer than repair one that’s 10 years old.
  2. The problem may not be fixable. The hardware and software may be incompatible, and your only choice is to replace one of the system components.
  3. The problem may reoccur. We can remove malware, install anti-malware software and provide recommendations for IT policies and procedures to stop the problem from recurring, but we can’t guarantee your systems won’t become re-infected.

2. Where will the work be performed?

Very few IT services need to be performed on-site any more. While some clients may hire us because we’re a Detroit IT services firm, we actually support clients across the country. Even when clients are right in our township, it’s often simpler and more cost effective to login remotely. That said, when you need software training or have multiple hardware and software issues that need to be diagnosed and resolved, it can be valuable to have local IT professionals come on site.

3. Are you a value-added reseller (VAR) or an independent IT advisor?

Value added resellers typically make a commission on top of the IT services revenue. An independent IT advisor may make an affiliate fee – or may not. The reason you want to know is because a VAR is not going to be as objective. They have a particular software solution to sell. They’re not looking for the BEST software solution for your organization. They’re looking for a good fit with the software they sell.

Now, if you’ve done a software evaluation and you know you want to implement QuickBooks Premier (for example), it makes sense to work with a QuickBooks Pro Advisor who knows the software inside and out. We partner with small business software VARS all the time.

As an independent IT consulting firm, we start with questions like “What’s possible?” “What’s the BEST way to achieve your business goals using technology?”
That may mean looking at several small business software solutions – or even custom software development. We begin with the end in mind and work backward toward the right software solution.

4. Do you do software configuration or software customization?

When an IT consulting firm says they do software configuration, what they mean is that they set it up for your organization. In the case of QuickBooks Premier, they’ll ask you a series of questions, like:

  • When’s your fiscal year end?
  • What states do you pay sales tax in?
  • Are you on a cash or accrual basis?
  • What financial reporting do you need?

The system already supports these options, so the main job of the small business IT consulting services firm is to ensure you understand the questions, and that the software is setup correctly.

When the term is used correctly, software customization can mean a multitude of things, but it ALWAYS involves software programming. Software customization includes:

  • Taking a base pre-packaged software solution, like QuickBooks, and adding features that are unique to your organization. For example, you may take orders in from the web and create an auto-look up of shipping weight and zip code to create a custom shipping cost.
  • Building custom integrations between two software programs.
  • Building an entirely new software program that’s customized to meet your needs. However, this is more commonly (and more accurately) called custom software development or custom software programming.

5. Do you outsource software development overseas or do you use US-based IT professionals?

In this global Internet-connected economy, it’s easier than ever to outsource software development overseas. While you may be able to lower the cost of your IT project, you also need to consider:

  • Business & industry expertise: With most offshore developers, you can’t just “hand off” a project. They don’t understand your business or industry. Can you develop a scope of work that is 100% clear on what you expect to have built? Will the offshore development team understand how to handle exceptions?
  • Communication: How will you communicate your needs? Working with an overseas developer means much more than overcoming a language barrier. Understanding how to translate ideas to software code is a challenge for all programmers.
  • Quality: What’s the quality of the software code? How will it be tested?
  • Support & Upgrades: Will anyone else be able to support the software? How will you upgrade and enhance the software in the future?
  • Privacy: Will your sensitive data and proprietary processes be protected?

Finding the Right IT Services Partner

Very few small businesses today can thrive without leveraging technology to boost efficiency and track metrics. Very small businesses may be able to get by with GeekSquad-type support. As your business grows in size and complexity, it pays to find a strategic technology advisor who has understands both your business goals – and your business challenges. If we can help, please let us know!

What other questions do you ask when you’re hiring an IT consulting firm? Leave us a note in the comments below.

technology business

Custom Software Development: Care & Feeding Tips

custom software development maintenance

Custom Software Development – Post Implementation Tips

Custom software applications help businesses get the exact functionality they need. When you’re the only business that does what you do, custom software is a way to add speed and enforce structure, while retaining your unique business processes.

Software Development Tools

Over the last 20 years, our software development team has developed, modified and maintained tons of custom applications. In our early years, we used Microsoft Access for many of the applications we developed.  In fact, we still do quite a bit of Access maintenance work. However, for new software projects, we’ve primarily switched to using rapid software development tools like Django and Python with PostgreSQL or Microsoft SQL Server.

If you’re the business owner or department head, you probably don’t care that much about the software development tools themselves. Your focus (rightly so) is on getting the right solution that fits your needs and is easy to maintain.

What often gets overlooked is the plan for routine custom software maintenance.

Maintaining Custom Software

Like ALL software, custom software needs to be regularly updated and maintained. Unlike off-the-shelf software, the maintenance schedule is primarily driven by you. Certain events may trigger an update:

  • Release of new operating system environments (like Windows 10)
  • Loss of a key software developer
  • Upgrade of a connected software application
  • Change in business processes and procedures

But some clients like to play the “How long can we hold out from upgrading?” game.

Is this you?

  • You have an older computer or server entirely dedicated to running this one application.
  • There’s only one person who is allowed to touch the programming code for fear the entire system will crash.
  • Your business can’t upgrade its systems or business processes because you don’t know how it will impact your custom software.

Outdated Custom Software Creates Risk

You may think you’re stretching your IT budget, but that’s not always true. Delaying custom software updates can add unnecessary risk and cost.

  • Clients who maintain their software regularly typically don’t have to start from scratch every few years.
  • As technology advances – and your custom software doesn’t – your company may be missing out on features that increase efficiency, security and profitability.
  • You may be “forced” to upgrade or replace your software at a time that’s inconvenient.
  • You risk having no one left who is willing or able to support your application.

Make Updates Part of Your Custom Software Development Plan

If you decide to build custom software, budget a certain amount of money to keep your software up-to-date and backed up. You may not know which operating system or database updates will require a patch to your software, but you can expect to do some software maintenance on a regular basis.

Backup and Recovery for Custom Software

Companies that use custom software need to have backup and recovery processes for both the production system and the software source code. The production system, which is the executable version of the software in use in your office, should be backed up regularly with the rest of your company files and databases.

You should also consider how and where the source code is backed up. Without the source code, you won’t be able to make changes to the software program itself. You and your software development company should discuss how many versions of the source code to keep, and the frequency and location of the source code backups. You should be able to access this code in the event something happens to your software development team.

Finally, insist on keeping a change log of updates to the software. If you ever need to bring in a different software development team, this documentation can help them get up to speed quickly.

Need Help?

The custom software development team here at Eclipse Consulting has built mobile apps, custom apps, integrations, and customizations using a wide variety of software development tools. We can help you build from scratch or update the solution you have in place today. See the questions you need to evaluate small business IT consulting services.

Give us a call at 586.263.1775 or click below to see how we can help.

Request a Tech Check

Portfolio Items