Read IMD File from Python

8 posts / 0 new
Last post
VITOPIEPOLI
Offline
Joined: 10/29/2019 - 11:28
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};"
 
    "DSN=NSSO2018;"
 
    "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?
Thanks
 

Brian Element's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57

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
Offline
Joined: 10/29/2019 - 11:28

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,
Vito

Brian Element's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57

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
Offline
Joined: 10/29/2019 - 11:28

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,
Vito

Brian Element's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57

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.

Brian Element's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57

Hi Vitopiepoli,

I have attached a jupyter notebook and a python script (both are the same) on how to use the IDEALib.py to import IDEA files to python and vice versa.  I also put together a video on how to use it https://www.youtube.com/watch?v=4-vfJsZrE20

VITOPIEPOLI
Offline
Joined: 10/29/2019 - 11:28

That is great, many thanks.
Vito