![]() |
VOOZH | about |
The rich ecosystem of Python modules lets you get to work quickly and integrate your systems more effectively. With the CData Python Connector for Reckon Accounts Hosted and the petl framework, you can build Reckon Accounts Hosted-connected applications and pipelines for extracting, transforming, and loading Reckon Accounts Hosted data. This article shows how to connect to Reckon Accounts Hosted with the CData Python Connector and use petl and pandas to extract, transform, and load Reckon Accounts Hosted data.
With built-in, optimized data processing, the CData Python Connector offers unmatched performance for interacting with live Reckon Accounts Hosted data in Python. When you issue complex SQL queries from Reckon Accounts Hosted, the driver pushes supported SQL operations, like filters and aggregations, directly to Reckon Accounts Hosted and utilizes the embedded SQL engine to process unsupported operations client-side (often SQL functions and JOIN operations).
Connecting to Reckon Accounts Hosted data looks just like connecting to any relational data source. Create a connection string using the required connection properties. For this article, you will pass the connection string as a parameter to the create_engine function.
The connector makes requests to Reckon Accounts Hosted through OAuth. Specify the following connection properties:
CData provides an embedded OAuth application that simplifies OAuth desktop authentication. See the Help documentation for information on other OAuth authentication methods (web, headless, etc.), creating custom OAuth applications, and reasons for doing so.
After installing the CData Reckon Accounts Hosted Connector, follow the procedure below to install the other required modules and start accessing Reckon Accounts Hosted through Python objects.
Use the pip utility to install the required modules and frameworks:
pip install petl pip install pandas
Once the required modules and frameworks are installed, we are ready to build our ETL app. Code snippets follow, but the full source code is available at the end of the article.
First, be sure to import the modules (including the CData Connector) with the following:
import petl as etl import pandas as pd import cdata.reckonaccountshosted as mod
You can now connect with a connection string. Use the connect function for the CData Reckon Accounts Hosted Connector to create a connection for working with Reckon Accounts Hosted data.
cnxn = mod.connect("SubscriptionKey=my_subscription_key;CountryVersion=2021.R2.AU;CompanyFile=Q:/CompanyName.QBW;User=my_user;Password=my_password;CallbackURL=http://localhost:33333;OAuthClientId=my_oauth_client_id;OAuthClientSecret=my_oauth_client_secret;InitiateOAuth=GETANDREFRESH;")
Use SQL to create a statement for querying Reckon Accounts Hosted. In this article, we read data from the Accounts entity.
sql = "SELECT Name, Balance FROM Accounts WHERE IsActive = 'true'"
With the query results stored in a DataFrame, we can use petl to extract, transform, and load the Reckon Accounts Hosted data. In this example, we extract Reckon Accounts Hosted data, sort the data by the Balance column, and load the data into a CSV file.
table1 = etl.fromdb(cnxn,sql) table2 = etl.sort(table1,'Balance') etl.tocsv(table2,'accounts_data.csv')
In the following example, we add new rows to the Accounts table.
table1 = [ ['Name','Balance'], ['NewName1','NewBalance1'], ['NewName2','NewBalance2'], ['NewName3','NewBalance3'] ] etl.appenddb(table1, cnxn, 'Accounts')
With the CData Python Connector for Reckon Accounts Hosted, you can work with Reckon Accounts Hosted data just like you would with any database, including direct access to data in ETL packages like petl.
Download a free, 30-day trial of the CData Python Connector for Reckon Accounts Hosted to start building Python apps and scripts with connectivity to Reckon Accounts Hosted data. Reach out to our Support Team if you have any questions.
import petl as etl
import pandas as pd
import cdata.reckonaccountshosted as mod
cnxn = mod.connect("SubscriptionKey=my_subscription_key;CountryVersion=2021.R2.AU;CompanyFile=Q:/CompanyName.QBW;User=my_user;Password=my_password;CallbackURL=http://localhost:33333;OAuthClientId=my_oauth_client_id;OAuthClientSecret=my_oauth_client_secret;InitiateOAuth=GETANDREFRESH;")
sql = "SELECT Name, Balance FROM Accounts WHERE IsActive = 'true'"
table1 = etl.fromdb(cnxn,sql)
table2 = etl.sort(table1,'Balance')
etl.tocsv(table2,'accounts_data.csv')
table3 = [ ['Name','Balance'], ['NewName1','NewBalance1'], ['NewName2','NewBalance2'], ['NewName3','NewBalance3'] ]
etl.appenddb(table3, cnxn, 'Accounts')
Download a Community License of the Reckon Accounts Hosted Connector to get started:
Download NowLearn more:
👁 Reckon Accounts Hosted IconPython Connector Libraries for Reckon Accounts Hosted Data Connectivity. Integrate Reckon Accounts Hosted with popular Python tools like Pandas, SQLAlchemy, Dash & petl.