Python Connector for Dynamics 365 Business Central
Python Connector for Dynamics 365 Business Central is a connectivity solution for accessing Dynamics 365 Business Central from Python applications to read and update data. It fully implements the Python DB API 2.0 specification. The connector is distributed as a wheel package for Windows and Windows Server.
Standard SQL syntax
The connector fully supports the ANSI SQL standard and lets you execute SQL statements against your Dynamics 365 Business Central data just like you would normally work with relational databases. Simple queries are directly converted to Dynamics 365 BC API calls and executed on the Dynamics 365 BC side. Complex queries are transformed into simpler queries, which are then converted to Dynamics 365 BC API calls. The embedded SQL engine then processes the results in the local cache and applies advanced SQL features from the original complex query.
Connecting
To establish a connection to Dynamics 365 Business Central, import
the connector and use the connect() method with your connection parameters.
Import the connector
First, import the Dynamics connector module:
import devart.dynamicsbc as dynamicsbc
Establish a connection
Connect to your Dynamics 365 Business Central environment using the connect() module method and obtain a connection object.
You can connect to Dynamics 365 Business Central using either basic authentication or OAuth 2.0 authentication.
Basic authentication
For basic authentication, provide your Dynamics 365 Business Central server URL and authentication credentials:
my_connection = dynamicsbc.connect(
Authentication="Basic", Server="your_dynamics365_url", UserId="your_username", AccessKey="your_access_key", CompanyId="your_company_id"
)
Replace the example values with your actual connection values.
OAuth 2.0 authentication
For OAuth 2.0 authentication, first obtain a refresh token, then retrieve your environments and companies, and finally establish the connection:
response = dynamicsbc.signin()
my_environments = dynamicsbc.getenvironments(
RefreshToken=response["Refresh Token"]
)
my_companies = dynamicsbc.getcompanies(
RefreshToken=response["Refresh Token"],
Environment=my_environments[0]
)
my_connection = dynamicsbc.connect(
Authentication="OAuth",
RefreshToken=response["Refresh Token"],
Environment=my_environments[0],
CompanyId=my_companies[0]["Company Id"]
)
Replace the example values with your actual connection values.
Querying data
Once connected, you can execute SQL queries to retrieve data from your Dynamics 365 Business Central environment.
Execute a query
Create a cursor object using the cursor() connection method.
my_cursor = my_connection.cursor()
Execute a SQL query using the execute() cursor method.
my_cursor.execute("SELECT * FROM Company")
Retrieve results using one of the fetch*() methods.
for row in my_cursor.fetchall():
print(row)
Parameterized queries
You can use parameterized queries to pass variable values to your SQL statements. This allows you to reuse the same query with different data and helps to prevent SQL injection attacks.
Pass parameters as a list or tuple to the execute() method:
query = "SELECT Id, Name FROM Contact WHERE Name = ? AND Email = ?"
params = ["Jordan Sanders", "jordansanders@example.com"]
my_cursor.execute(query, params)
results = my_cursor.fetchall()
for row in results:
print(row)
Each placeholder ? in the query is replaced with a corresponding value from the parameter list.
Ordering and activating the license
You can purchase a license for the connector on the ordering page:
https://www.devart.com/python/dynamicsbc/ordering.html
To activate the license, follow the instructions in the documentation:
https://docs.devart.com/python/dynamicsbc/activate-a-license.htm
What's new
Python Connector for Dynamics 365 Business Central 1.2
- Added support for Python 3.15
Metadata
Release files for devart-dynamicsbc-connector 1.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
Total release size: 65.5 MB
Release files / devart_dynamicsbc_connector-1.2.0-cp315-cp315-win_amd64.whl
| Download URL | devart_dynamicsbc_connector-1.2.0-cp315-cp315-win_amd64.whl |
|---|---|
| Size | 5.6 MB |
| Tags | CPython 3.15 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
b305bb158cd3f288540e9cac20f5b9a9985654ad5d1235aee13a23646db03b78
|
|
BLAKE2b-256 checksum How to use checksums |
09d70c9943a9c7891d7b9be1ee17c023f722acca0b707aa01db63c3c73de9ddf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.4
|
Release files / devart_dynamicsbc_connector-1.2.0-cp315-cp315-win32.whl
| Download URL | devart_dynamicsbc_connector-1.2.0-cp315-cp315-win32.whl |
|---|---|
| Size | 5.4 MB |
| Tags | CPython 3.15 Windows x86-32 |
|
SHA-256 checksum How to use checksums |
046b2c2b65b03684743b17d33c18871fd89ac76327a5fedc14bf4647c0ae058e
|
|
BLAKE2b-256 checksum How to use checksums |
0440a48c105efa2ebdeff7bdac43c316dbce476c5122f2b38c8b4f721b40f420
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.4
|
Release files / devart_dynamicsbc_connector-1.2.0-cp314-cp314-win_amd64.whl
| Download URL | devart_dynamicsbc_connector-1.2.0-cp314-cp314-win_amd64.whl |
|---|---|
| Size | 5.6 MB |
| Tags | CPython 3.14 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
cef80b98914fd2592eb9da7b8011dac01f0e7d72ab9c5fc246b9da82b225b6a4
|
|
BLAKE2b-256 checksum How to use checksums |
4e4f28615f4f0f88a802a1c260c5d2d1f234d5f8d72636310c74ca7f82b796fe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.4
|
Release files / devart_dynamicsbc_connector-1.2.0-cp314-cp314-win32.whl
| Download URL | devart_dynamicsbc_connector-1.2.0-cp314-cp314-win32.whl |
|---|---|
| Size | 5.4 MB |
| Tags | CPython 3.14 Windows x86-32 |
|
SHA-256 checksum How to use checksums |
9640296678b1a3283fa9103f302081238a0c593c3eafd7bd3fe92130be83f952
|
|
BLAKE2b-256 checksum How to use checksums |
9b8ade70f0a65dff2eb9002d2a5f7ea9e145dc8d9c89b40a400958c992f45ac1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.4
|
Release files / devart_dynamicsbc_connector-1.2.0-cp313-cp313-win_amd64.whl
| Download URL | devart_dynamicsbc_connector-1.2.0-cp313-cp313-win_amd64.whl |
|---|---|
| Size | 5.6 MB |
| Tags | CPython 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
58c0b831f8f23b4dc8f9fb3b44e6076bab7eee39de3931ba71082eb5bc4184ee
|
|
BLAKE2b-256 checksum How to use checksums |
494abf2898278cd0facbef238b56e4bbc83a84a6fabc568794e0819bd89c2462
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.4
|
Release files / devart_dynamicsbc_connector-1.2.0-cp313-cp313-win32.whl
| Download URL | devart_dynamicsbc_connector-1.2.0-cp313-cp313-win32.whl |
|---|---|
| Size | 5.3 MB |
| Tags | CPython 3.13 Windows x86-32 |
|
SHA-256 checksum How to use checksums |
bb317767af818f9b49c86416d0233f74bebce06c13deba477d399d491508567e
|
|
BLAKE2b-256 checksum How to use checksums |
4b1c0e24c9d9c65324147788696c3911a68b9fb3a741373905b5c687b135f9ec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.4
|
Release files / devart_dynamicsbc_connector-1.2.0-cp312-cp312-win_amd64.whl
| Download URL | devart_dynamicsbc_connector-1.2.0-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 5.6 MB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
08a7ce7f12499aa35655b4193a3c35758cb1474af5895761c6edc4c81d8e478b
|
|
BLAKE2b-256 checksum How to use checksums |
f8b5a88fbda70bbb70e81d958e654079dc39730ac2fdaa5564397f8d6b290044
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.4
|
Release files / devart_dynamicsbc_connector-1.2.0-cp312-cp312-win32.whl
| Download URL | devart_dynamicsbc_connector-1.2.0-cp312-cp312-win32.whl |
|---|---|
| Size | 5.3 MB |
| Tags | CPython 3.12 Windows x86-32 |
|
SHA-256 checksum How to use checksums |
c5df981a3d49897a970cdc51a9a0a9fa61d96b2267f646f12c528c98f88a0d23
|
|
BLAKE2b-256 checksum How to use checksums |
362cfba0e2f367ff64a8cb21fedbbe486407cd619dca166f53c8e751342fad00
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.4
|
Release files / devart_dynamicsbc_connector-1.2.0-cp311-cp311-win_amd64.whl
| Download URL | devart_dynamicsbc_connector-1.2.0-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 5.6 MB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
b86ad82ca25046176602faddf8ae17d066dac028ac1e26b69100cc1bc7bbd12a
|
|
BLAKE2b-256 checksum How to use checksums |
3a3c2b6c1d1eac2428cb89ba827ad0843db85f5402ff390ab357d47520d47cde
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.4
|
Release files / devart_dynamicsbc_connector-1.2.0-cp311-cp311-win32.whl
| Download URL | devart_dynamicsbc_connector-1.2.0-cp311-cp311-win32.whl |
|---|---|
| Size | 5.3 MB |
| Tags | CPython 3.11 Windows x86-32 |
|
SHA-256 checksum How to use checksums |
07ad9a39917ad6fa146138f82156495c7ced71b2ea4cb80255b3a6bb583910a8
|
|
BLAKE2b-256 checksum How to use checksums |
84dd477210c6e2b60f4d2e11032a44c2deed1cac47338653e612ee1dd0059c3e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.4
|
Release files / devart_dynamicsbc_connector-1.2.0-cp310-cp310-win_amd64.whl
| Download URL | devart_dynamicsbc_connector-1.2.0-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 5.6 MB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
cf720c42e9552abb8a17642efad57a08a676e23a347aaf751348b18eca190d0c
|
|
BLAKE2b-256 checksum How to use checksums |
d4306aedb8fd0c12a3a495b2d6aef8400684a50cd3b4f4fa7bc499097c05f1cc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.4
|
Release files / devart_dynamicsbc_connector-1.2.0-cp310-cp310-win32.whl
| Download URL | devart_dynamicsbc_connector-1.2.0-cp310-cp310-win32.whl |
|---|---|
| Size | 5.3 MB |
| Tags | CPython 3.10 Windows x86-32 |
|
SHA-256 checksum How to use checksums |
3a907c93445ac5c0c499f8ef2fb9e025afdc0d062c58dcbd6ecf4324562b9740
|
|
BLAKE2b-256 checksum How to use checksums |
78fdb912a55206d047799bea73854f9228a68bc1948c003b393df14e2a656996
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.4
|
Security for devart-dynamicsbc-connector 1.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.