New level of functionality and performance in data access via Python
Project description
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.
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.1
- Added support for Python 3.14
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file devart_dynamicsbc_connector-1.1.0-cp314-cp314-win_amd64.whl.
File metadata
- Download URL: devart_dynamicsbc_connector-1.1.0-cp314-cp314-win_amd64.whl
- Upload date:
- Size: 5.6 MB
- Tags: CPython 3.14, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7447346d7e1ad549c1581953c7a2dd4aaf76a419dfaaf6ffe6adea7961897ae1
|
|
| MD5 |
d3cfd8fb4e4a2b9bd46fe02b7cbc03aa
|
|
| BLAKE2b-256 |
fae4fac07e1f439c875afa19768086c44a021089e132c0867ee3010d48cb3e65
|
File details
Details for the file devart_dynamicsbc_connector-1.1.0-cp314-cp314-win32.whl.
File metadata
- Download URL: devart_dynamicsbc_connector-1.1.0-cp314-cp314-win32.whl
- Upload date:
- Size: 5.3 MB
- Tags: CPython 3.14, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cf1f1e28ede048cf1512a9ed8cf6c7d2eb8dcc601eaccae18208593a26d9faca
|
|
| MD5 |
7ad10dd816264cc3dc6cfd0765189dc1
|
|
| BLAKE2b-256 |
b50a4b84548acc6ca1255b59df37b380756d98c83ae779b9ed99f2665ba82b4b
|
File details
Details for the file devart_dynamicsbc_connector-1.1.0-cp313-cp313-win_amd64.whl.
File metadata
- Download URL: devart_dynamicsbc_connector-1.1.0-cp313-cp313-win_amd64.whl
- Upload date:
- Size: 5.5 MB
- Tags: CPython 3.13, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
962d70003ddc8044bbbf59234578492cde523a0e70d322b51271254f6d4581f0
|
|
| MD5 |
ba0f764d6b63594463acd99e536659de
|
|
| BLAKE2b-256 |
e329ea5acc154004f69a986bd607c338effbbe0ad73fb7c14b2337c155faf329
|
File details
Details for the file devart_dynamicsbc_connector-1.1.0-cp313-cp313-win32.whl.
File metadata
- Download URL: devart_dynamicsbc_connector-1.1.0-cp313-cp313-win32.whl
- Upload date:
- Size: 5.3 MB
- Tags: CPython 3.13, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ef71219bb864c0519fb786db966f6f6aadac5381d25bd1c8b68ce3848d258db6
|
|
| MD5 |
08a33e6541c24d8fe0ec1d23c49bc89d
|
|
| BLAKE2b-256 |
a4b636275919164a2e58163a4e20cdef8a795ffb47d2b1c8278577c2191baad5
|
File details
Details for the file devart_dynamicsbc_connector-1.1.0-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: devart_dynamicsbc_connector-1.1.0-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 5.5 MB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
16e7a2103044e1e859f9407b2047aeadbfc2188380aacc4383911aef45c84437
|
|
| MD5 |
2e809c0624bfd5cf27f6f6e782e6d7e8
|
|
| BLAKE2b-256 |
0888c51c7faee63c565e9d721d77543ebf645783fe829c724c84ff478c917adb
|
File details
Details for the file devart_dynamicsbc_connector-1.1.0-cp312-cp312-win32.whl.
File metadata
- Download URL: devart_dynamicsbc_connector-1.1.0-cp312-cp312-win32.whl
- Upload date:
- Size: 5.3 MB
- Tags: CPython 3.12, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
df37d8b929a180356b7759256ece7e68408473866516ab6097ccbd6efddc084c
|
|
| MD5 |
11910cd09434412ceb78bc676f023601
|
|
| BLAKE2b-256 |
eb8c59f6fd9abe005ef2fa2e21e546d6e9285a27a78bab901777bfdbe2e3e0ea
|
File details
Details for the file devart_dynamicsbc_connector-1.1.0-cp311-cp311-win_amd64.whl.
File metadata
- Download URL: devart_dynamicsbc_connector-1.1.0-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 5.5 MB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fb4cf1c30e19b37deb6011c2f94af370a681603440d44f82e667aacb8f658607
|
|
| MD5 |
c530ab3a05f53c282ae616fc96ed3f9d
|
|
| BLAKE2b-256 |
044cd83df6c217b3d6f2fbc83fe077631555bbd008b6743f0490b554c8147ad7
|
File details
Details for the file devart_dynamicsbc_connector-1.1.0-cp311-cp311-win32.whl.
File metadata
- Download URL: devart_dynamicsbc_connector-1.1.0-cp311-cp311-win32.whl
- Upload date:
- Size: 5.3 MB
- Tags: CPython 3.11, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eeb7cad01c9524ae6911dc3072067d7f215eeac18ef9020fe2f38d352812ff5d
|
|
| MD5 |
2013ca6c56b87cd498e009efd7869c29
|
|
| BLAKE2b-256 |
a1d4d61ee523e604cc0b8971ca22c49b07bea9e0300b03378113b21609b15557
|
File details
Details for the file devart_dynamicsbc_connector-1.1.0-cp310-cp310-win_amd64.whl.
File metadata
- Download URL: devart_dynamicsbc_connector-1.1.0-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 5.5 MB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
64ee8aebf2f64856dad30e4a7bbdccd7157f92b8f2283082c823e0c04a5dbec9
|
|
| MD5 |
de3686ecbeb0cde2c132e54b1d5ba700
|
|
| BLAKE2b-256 |
a6c0a3a20461ba8d7539378b81ef44b47ae9dc94d9ebdea6a8dbebf55218c1f2
|
File details
Details for the file devart_dynamicsbc_connector-1.1.0-cp310-cp310-win32.whl.
File metadata
- Download URL: devart_dynamicsbc_connector-1.1.0-cp310-cp310-win32.whl
- Upload date:
- Size: 5.3 MB
- Tags: CPython 3.10, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8845c258faa41c34b36945e5f6e21d49288e791a932d8ac955fc463839b7b8d0
|
|
| MD5 |
798446f4b9afd1a3c6048610c67fdbe3
|
|
| BLAKE2b-256 |
3db7834b127a5af0cf3db01f98db617fef05ef8795f3cf12d92d7364e6f7b695
|
File details
Details for the file devart_dynamicsbc_connector-1.1.0-cp39-cp39-win_amd64.whl.
File metadata
- Download URL: devart_dynamicsbc_connector-1.1.0-cp39-cp39-win_amd64.whl
- Upload date:
- Size: 5.5 MB
- Tags: CPython 3.9, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d428ea6e713e0f7d75aac22802875451957ba623184285df4d8c630d9067753e
|
|
| MD5 |
8e670bc0bed997fc13d5d3855bd20532
|
|
| BLAKE2b-256 |
d43bc3fbd7382e8b05a5dddb5dc06b63e254313739c6f6e410f7fdf0d0029f21
|
File details
Details for the file devart_dynamicsbc_connector-1.1.0-cp39-cp39-win32.whl.
File metadata
- Download URL: devart_dynamicsbc_connector-1.1.0-cp39-cp39-win32.whl
- Upload date:
- Size: 5.3 MB
- Tags: CPython 3.9, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6f73aab7a25c9f8360882a609499d3af8b6c4b092a333bf95f6f1c0962b868e0
|
|
| MD5 |
b4133087eb14efd182c5ce8c1e549fc8
|
|
| BLAKE2b-256 |
de5e4661877ef2abbca574136e91ffeea39105cc01c3c1fbd01d2c7e14c10a02
|
File details
Details for the file devart_dynamicsbc_connector-1.1.0-cp38-cp38-win_amd64.whl.
File metadata
- Download URL: devart_dynamicsbc_connector-1.1.0-cp38-cp38-win_amd64.whl
- Upload date:
- Size: 5.5 MB
- Tags: CPython 3.8, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cb17351e90f13125099d7869b6a0537697ad54e74c0edaec6f3414d160949229
|
|
| MD5 |
3d9cfd50bb4284597e1194b6ceb416eb
|
|
| BLAKE2b-256 |
2630dcc4722efa2adaa1d3dce3761e6ee1cc279f936d3e624ec47c55b5564097
|
File details
Details for the file devart_dynamicsbc_connector-1.1.0-cp38-cp38-win32.whl.
File metadata
- Download URL: devart_dynamicsbc_connector-1.1.0-cp38-cp38-win32.whl
- Upload date:
- Size: 5.3 MB
- Tags: CPython 3.8, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ef930d5ee3c7ec1c91b55e2083de89e4cfa099b5dec6cbaafa1f571d6a1697ab
|
|
| MD5 |
b0b7d0bcf27f35463f67724f1c8e3804
|
|
| BLAKE2b-256 |
b0b1f6258007e23fc78d1062d55e3b0e531b0171972be84b9ab056c3ff6d560d
|
File details
Details for the file devart_dynamicsbc_connector-1.1.0-cp37-cp37m-win_amd64.whl.
File metadata
- Download URL: devart_dynamicsbc_connector-1.1.0-cp37-cp37m-win_amd64.whl
- Upload date:
- Size: 5.5 MB
- Tags: CPython 3.7m, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9fca715d1318b22c4befb9bc464ff481a1d971ca86c1cf064aad26e7f1aa00d4
|
|
| MD5 |
cdf1f15abbf6025be3537173880932b7
|
|
| BLAKE2b-256 |
b2ebf6de5595cd1ba560ebbe46b62a895032b84bd583e72ead85958d56a0b01f
|
File details
Details for the file devart_dynamicsbc_connector-1.1.0-cp37-cp37m-win32.whl.
File metadata
- Download URL: devart_dynamicsbc_connector-1.1.0-cp37-cp37m-win32.whl
- Upload date:
- Size: 5.3 MB
- Tags: CPython 3.7m, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ae9faa84f6255e4c6d8d7282fc9fa28b1cff50e38adb861e5ba55c2c3e8c3f9e
|
|
| MD5 |
90564a1cba41ae4cb4c1fb769fa5b56e
|
|
| BLAKE2b-256 |
09d614dde1ce5e6b413dc9a31413516dd2e43157f1a876dd90083c10f504f4bc
|