This code shows PyODBC, and the Native API access. It is required for the Python quickstart which can be found here:
https://learning.intersystems.com/course/view.php?name=Python%20QS
Note that our code and supporting wheel files are designed for Python 3. If you want to use Python 2, please contact us for more details.
Operating System | Version |
---|---|
Windows | Windows 10, Windows Server 2012, 2016, 2019 |
Mac | Apple macOS 10.13, 10.14 |
Linux |
|
pyodbcplaystocksTask1.py
to make a connection to an instance of InterSystems IRIS Data Platform using PyODBCpyodbcplaystocksTask7.py
: to see how to store and retrieve data relationallynativeplaystocksTask1.py
to make a connection to an instance of InterSystems IRIS Data Platform using the Native APInativeplaystocksTask6.py
: to see how to access directly the underlying structure within InterSystems IRIS
connection.config
: contains connection details for PyODBC and Native API.
nativeAPI_wheel
: contains installation wheels for using Python with Native API.pyodbc_wheel
: contains installation wheels for using Python with PyODBC.
-
Verify you have an instance of InterSystems IRIS, and an IDE that supports Python (such as PyCharm). To download Community Edition locally, get an InterSystems IRIS installation kit from the Developer Download page. If you are using AWS, Azure, or GCP, that you have followed the steps to change the password for InterSystems IRIS.
-
If you are using AWS, GCP, or Microsoft Azure, load the sample stock data into InterSystems IRIS:
$ iris load http://github.com/intersystems/Samples-Stock-Data
If you are using InterSystems Labs, the sample stock data is already loaded. You can skip to the next step.
-
Clone the repo and open it in your IDE. Notes that all codes and supported materials are in Solutions folder
-
In
connection.config
file, modify the host and password to be the correct values for your InterSystems IRIS instance. Although port and username are most likely the defaults, you should verify those values are corrects.
Note: If you have InterSystems IRIS installed locally in your machine, you do not need to set up InterSystems PyODBC driver.
Prerequisite: You should have PyODBC already installed in your local machine. If you having trouble installing PyODBC, please see how to install PyODBC
Before installing InterSystems driver, navigate to the Solutions directory of your terminal: cd Solutions
Operating System | Command |
---|---|
Local instance | InterSystems IRIS PyODBC driver is installed. You can skip this step. |
Windows | pyodbc_wheel\ODBC-2022.1.0.209.0-win_x64.exe |
Mac | odbcinst -i -d -f pyodbc_wheel/mac/odbcinst.ini |
Linux | sudo odbcinst -i -d -f pyodbc_wheel/linux/odbcinst.ini |
Note: Due to the dash(-
) being different in each operating system, you might need to retype the command if you encounter errors.
Before installing, make sure you are in Solutions directory of your terminal.
Operating System | Command |
---|---|
Window | pip install nativeAPI_wheel\irisnative-1.0.0-cp34.cp35.cp36.cp37.cp38.cp39-none-win_amd64.whl |
Mac | pip install nativeAPI_wheel/irisnative-1.0.0-cp34-abi3-macosx_10_13_x86_64.macosx_10_14_x86_64.whl |
Linux | pip install nativeAPI_wheel/irisnative-1.0.0-cp34-abi3-linux_x86_64.whl |
- Run
python pyodbcplaystocksTask1.py
to make a connection to an instance of InterSystems IRIS Data Platform using the PyODBC. - Run
python nativeplaystocksTask1.py
to make a connection to an instance of InterSystems IRIS Data Platform using the Native API.