Read data to Progress database using Python

Here’s a sample Python code to read data from a Progress database using the pyodbc library

import pyodbc

# Set up the connection to the Progress database
conn = pyodbc.connect('DRIVER={Progress OpenEdge 10.2A Driver};HOST=<your host>;PORT=<port number>;DB=<database name>;UID=<username>;PWD=<password>')

# Set up a cursor to execute SQL queries
cursor = conn.cursor()

# Define the SQL query to select data from a table
sql_query = "SELECT column1, column2, column3 FROM my_table"

# Execute the SQL query and fetch the results
cursor.execute(sql_query)
results = cursor.fetchall()

# Print the results
for row in results:
    print(row)

# Close the connection
conn.close()

In this example, we first set up a connection to the Progress database using the pyodbc library. We then define a cursor to execute SQL queries, and define an SQL query to select data from a table.

We then execute the SQL query using the cursor and fetch the results using the fetchall() method. Finally, we loop through the results and print each row, and close the connection.

Pamai Tech
Turning ideas into Reality

Products

Office Add-in

Enterprise Solutions

Cloud Consulting

UI UX Design

Data Transformation

Services

FAQ's

Privacy Policy

Terms & Condition

Team

Contact Us

Company

About Us

Services

Features

Our Pricing

Latest News

© 2023 Pamai Tech