Skip to main content

Read IMD File from Python

Hi all,
I tried to access one my IMD files directly from Python using this code:
import pyodbc
import pandas as pd
# Define your connection string (this is a generic example and would need to be adjusted)
conn_str = (
    "DRIVER={CaseWare IDEA Driver};"
    "DBQ=D:/2018 database;"
# Establish the connection
conn = pyodbc.connect(conn_str)
but cannot make it work as i get:
Traceback (most recent call last)
Untitled-2 in line 12
      6 conn_str = (
      7     "DRIVER={CaseWare IDEA Driver};"
      8     "DSN=NSSO2018;"
      9     "DBQ=D:/2018 database;"
      10 )
     11 # Establish the connection
---> 13 conn = pyodbc.connect(conn_str)
OperationalError: ('08001', '[08001] [Simba][SimbaClient] (72) Missing required setting: SERVERLIST. (72) (SQLDriverConnect)'
DSN and Driver correctly installed as I can get access to file using Power Bi or Excel query.
Cannot access via Idea itself nor load in excel as it is too big even for a csv file.
Would you be so kind as to steer me in right direction?

Brian Element Thu, 02/08/2024 - 11:23

Are you trying to put an IDEA imd file into a panda dataframe?   It is possible, let me know the output and I will put something together to show you how to do this.

VITOPIEPOLI Thu, 02/08/2024 - 11:26

Hi Brian,
that is exactly it.
I did not write the SQL query as it will be just a SELECT * from DATABASE.
But the idea is to get IDEA flat table into pandas flat table.
Many thanks,

Brian Element Thu, 02/08/2024 - 11:33

Ok, it is simple to do once you know how to do it.  Give me a bit of time and I will put together a demo (maybe a video) on how this can be done.

VITOPIEPOLI Fri, 02/09/2024 - 05:53

Hi Brian,
Just the code is sufficient, but it you feel to post a video, it would be great.
I reckon I am not the only one with this need.
Many thanks,

Brian Element Fri, 02/09/2024 - 08:23

In reply to by VITOPIEPOLI

I have started working on it, should have something today or tomorrow.  I am doing a video as there are others that are also interested.