Visualize SQLite Data with Power BI | by Suraj Gurav | Towards Data Science

Power BI ⚡️Power BI Desktop supports a variety of data sources including Excel, SQL Server, IBM Db2 Database, and much more. Although the Power BI provides connectors to Azure SQL Database and SQL Data Warehouse, you will not find any connector for SQLite Database. But the good news is, you can still visualize this data in Power BI.⚡️
💡 The guided Project at the end of this write-up would be a great takeaway to display on your data science portfolio.
A few days ago, I created an SQLite Database to practice SQL queries. But, I was more curious about, how to visualize this data in Power BI. And then, I followed the below process to reach my goal.
The deeper insights into SQLite Database and how it is created can be taken in my earlier story here.
medium.com
Before starting the process, let me tell you more about the Hero 😎 of our story — SQLite ODBC Driver
Driver is the interface that facilitates the communication between two applications
ODBC stands for Open Database Connectivity.
It is the interface developed and maintained by Microsoft. We are going to use ODBC Driver to access the data from SQLite Database.
ODBC Driver allows us to add SQLite databases to its list of data sources and then this data source can be connected to any application for further analysis and visualization. Surely, these databases can be accessed through Python or any other programming. But, accessing it through the ODBC driver is much more convenient.
Let’s get started!
Let’s have a look at all things you need to proceed with this story.
An SQLite Database: I am giving away my self-created SQLite Database 📚 as a good takeaway. You can find it here. The name of the database file is tds.sqliteSQLite ODBC Driver: I found it already installed on some of my colleagues’ computers. However, you can download it anytime from here. Depending on your operating system, choose a 32-bit or 64-bit version.Power BI Desktop version: If you are a working professional, you can get access to Power BI Desktop using your work email address. If you are a student, your school email address will be required to gain access. The Power BI Desktop can be downloaded from here.
An SQLite Database: I am giving away my self-created SQLite Database 📚 as a good takeaway. You can find it here. The name of the database file is tds.sqlite
SQLite ODBC Driver: I found it already installed on some of my colleagues’ computers. However, you can download it anytime from here. Depending on your operating system, choose a 32-bit or 64-bit version.
Power BI Desktop version: If you are a working professional, you can get access to Power BI Desktop using your work email address. If you are a student, your school email address will be required to gain access. The Power BI Desktop can be downloaded from here.
This is simple and straightforward. Just look for ODBC Data Sources at the start menu and open it.
You will need either of these 3 drivers -1. SQLite ODBC Driver2. SQLite3 ODBC Driver3. SQLite ODBC (UTF-8) Driver
You can check this under the Drivers tab as shown in the picture below.
If you see any of the above-listed drivers, you can skip the installation of SQLite ODBC drivers.
The SQLite ODBC Driver can be downloaded here.
Once this driver is installed then check again if it is now visible in the ODBC Data Source Administrator, as shown in the previous picture.
By this point, you will be having SQLite ODBC Drivers and Power BI Desktop in place. Let’s start connecting the SQLite Database with Power BI through the ODBC driver.The next step is to create a name for the desired data source. Using this name, we can identify the desired data source while using Power BI.
The DSN in the above picture stands for Data Source Name. Search for ODBC Data Source Administrator in the start menu and then follow this picture to quickly set up the DSN. To complete the process, click on OK in the ODBC Data Source Administrator window after Step 8.
📌 Important points to keep in mind from the above picture are:
1. Select the correct ODBC driver as shown in step 32. Type in a meaningful Data Source Name as shown in step 53. Browse for the sqlite3 database file which you want to visualize in step 6. For this particular example, you can download my self-created database file.4. After step 7, you must see your DSN in the ODBC Data Source Administrator window as shown in step 8.
Coming one step closer to the goal 🎯, let us now connect the data source with Power BI. Simply open the Power BI Desktop and follow the below series of pictures.
As shown in the above picture, you have to choose the DSN for your data source which was created in the previous step. Once you click OK in step 7, you will be prompted to enter the connection credentials.
Just select the Default or Custom option and click on connect. Next, you will see all the available tables in the data source navigator window. Here you will also see the DSN on the top (As marked by the dotted blue rectangle below)
Select the tables you want to visualize and load the data as shown in the above picture. You can also choose the Transform Data option if you are interested in any data manipulations.
If the database has multiple tables and you are willing to visualize the data from more than one table, select them all and load the data. The relationship between the tables has to be created manually in the Model view in Power BI.
Time for the Action!!!🎭
As data from the SQL Database is now imported into the Power BI, a variety of visualizations can be created depending on the data available. Here are the visualizations that I created.
You can surely leverage the power of Power BI visualizations for creative visualizations. I have already started shifting my work from Excel to this on-disk database, you can also follow.
It can be a good idea to create your own dataset using Web Scraping, assess and clean it by practicing Data Wrangling techniques and store it in a SQL Database to finally visualize it in Power BI.
Long story short,
I walked you through the process of visualizing SQLite Data with Power BI. The step-by-step approach backed up with the appropriate pictures will surely assist you in better understanding.
If you wish to start directly without creating any database, No problem at all! The ready-made SQLite database file 📚 is waiting for you here on my Github repo.
Additionally, the project idea can be implemented with the resources given in it. As I always say, I am open to constructive feedback and knowledge sharing through LinkedIn.
Thank you for reading and your time!
I hope it helps you to practice DataViz on any data set.