Thank you so much. The command worked. I'll continue my work and let you know if I encounter any other issues or difficulties.
Original Message:
Sent: 05-06-2025 01:52
From: Peter Møller
Subject: Display linked PG table on MapInfo Pro 2023
Hey Ferhad
To call a MapBasic function from Python, you can use pro.EvalMapBasicCommandEx:
hdbc = pro.EvalMapBasicCommandEx("Server_Connect(connection parameters here)")
That will return the handle to the variable hdbc.
------------------------------
Peter Horsbøll Møller
Principal Presales Consultant | Distinguished Engineer
Precisely | Trust in Data
------------------------------
Original Message:
Sent: 05-05-2025 12:27
From: Ferhad Pakzat
Subject: Display linked PG table on MapInfo Pro 2023
Thank you so much Peter for the answer. I'm still trying hard to make it work. My question does involve opening the tables (your suggestions would perfectly work for that part) but it was more about downloading data (and saving as .tab files) from our PG server using python preferably. I can still try MapBasic way. It's just the interactions part between them is giving me a little hard time.
Is there any way that I can retrieve the results from pro.RunMapBasicCommandEx()? For instance, is it possible to get the hdbc (the handle for odbc conneciton built by MapBasic function server_connect())?
Would this work from Python side?
hdbc = pro.RunMapBasicCommandEx("Server_Connect(connection parameters here)")
------------------------------
Ferhad Pakzat
Bc Hydro And Power Author
Burnaby BC
Original Message:
Sent: 04-30-2025 02:50
From: Peter Møller
Subject: Display linked PG table on MapInfo Pro 2023
Hey Ferhad
pro.Catalog has this method, which may be what you are looking for:
OpenTable(IDataSource, TableDefinition)
Opens a table using the TableDefinition and IDataSource objects identified by the tableDef and dataSourceparameters.
I often use pro.RunMapBasicCommandEx() to execute MapBasic code from Python. This generally works well, too.
You can't do everything directly through Python, so some things still require MapBasic code.
------------------------------
Peter Horsbøll Møller
Principal Presales Consultant | Distinguished Engineer
Precisely | Trust in Data