Python

Using the Marple Python SDK

We created an SDK for Python that makes it easier to use our API. Install the marpledata module:

pip install marpledata

Usage

First setup the connection using an access token:

from marple import Marple
m = Marple(ACCESS_TOKEN)
m.check_connection()

Calling API endpoints is as easy as:

m.get('/version')
m.post('/sources/info', json={'id': 98})

Uploading data can be done in various ways:

  • Upload a file using the SDK

  • A pandas dataframe

  • Write data in chunks

These three commands will all upload a file test.csv to the /Examplefolder in your workspace:

source_id = m.upload_data_file('.../test.csv', '/example', metadata={'key': 'value'})
source_id = m.upload_data_pandas(dataframe, 'test', '/example')

for row in dataframe.itertuples(index=False):
    data_dict = row._asdict()
    m.add_data(data_dict)
    
source_id = m.send_data('test', 'example')

To check the import status:

status = m.check_import_status(source_id)

More details can be found at https://pypi.org/project/marpledata

Last updated