Skip to main content

Idea database to a pandas DF using win32com.client

Hello everyone! I'm looking to export my database into a pandas dataframe.
When utilizing an internal compiler, the process looks like this:
df = Idea.idea2py(database='mydatabase.idm', client=client)
However, I'd like to use the original Python for its additional debugging features.
import win32com.client as win32client
idea = win32client.Dispatch(dispatch="Idea.IdeaClient")
db = idea.opendatabase("mydatabase.idm")

What Python code should I use to accomplish this using the IdeaClient library?

Brian Element Wed, 10/11/2023 - 07:45

Hi bluered83132,

What the is doing when it is calling the idea2py function is that it is first saving the file as a text file.  Here is the function from that performs this task:

def _export_database_from_IDEA(db,client,tempPath):    
    exportPath = path.join(tempPath,"tempExport.del")     
    task = db.ExportDatabase()    
    task.IncludeFieldNames ="TRUE"
    eqn = ""

    task.PerformTask(exportPath,"Database","DEL UTF-8",1,db.Count,eqn)

    return exportPath 

You would then import the file using pandas.

Hope that helps out a bit.

bluered83132 Thu, 10/12/2023 - 05:20

In reply to by Brian Element

Thank you so much for your help! As i understood, there is no way to directly parse database through win32client, and idea2py after export also reads some temp file. Am i right?

Brian Element Thu, 10/12/2023 - 08:58

In reply to by bluered83132

That is right, there is no way to do this directly.  You have to export the IDEA database into a text file and then bring this into Pandas, do your analysis and then send it back to IDEA.  IDEA and pandas do not talk directly to each other.