This SDK facilitates interaction with a Syneton Admin Consult client through both API endpoints and direct SQL access.
For support on this Python library or questions regarding interfacing options with Admin Consult, please feel free to contact the repository owner ward.cornette@num3rix.fr.
To setup and configure the Admin Consult REST API, please consult the documentation by Syneton.
from examples.api.auth.auth import get_cred
from adminconsult.api.clientcredentials import ClientCredentials
from adminconsult.api.customer import Customer
admin_cred: ClientCredentials = get_cred()
# Get one customer
admin_customer = Customer(admin_cred)
admin_customer.get(id=9580)
print(admin_customer.name)
For use of SQL implementation, you must have SQL Anywhere driver installed: download SQL Anywhere (Sybase). Also, you need to request a DB user with read access via Syneton Support.
from examples.sql.auth.auth import get_cred
from adminconsult.sql import DbEngine
admin_cred_sql = get_cred()
admin_db = DbEngine(admin_cred_sql)
df_customers = admin_db.sql_query_df('''
SELECT *
FROM DBA.CUSTOMER c
WHERE c.COMPANY LIKE '%A' ''')
print('{} customers'.format(df_customers.shape[0]))
Use or create a subclass of the ClientCredentials
class for API or SQL authentication. This object reads and writes tokens using external storage.
Use one of the pre-implemented storage methods:
- json file
- hvac vault
The examples in this repo use credentials stored in a local json files. Create a .env
file which contains the path to the folder with these local json files. The .env file should look like this:
credentials_dir='C:\..'
Developments which might be improved but require an extension/change of the Admin Consult API are marked with #IMPROV#