Marple Docs
  • Introduction
  • Marple Insight
    • Welcome
      • What is Marple Insight?
      • FAQ
      • Feedback
      • Release Notes
      • Roadmap
    • Setup and Configuration
      • Data connection
        • Supported Databases
          • Azure Data Explorer (ADX)
          • Microsoft Fabric
          • TimescaleDB & PostgreSQL
          • Mireo Spacetime
          • InfluxDB (Beta)
        • Connection configuration
          • Required Queries
          • Optional Queries
          • Templating
      • Deployment
        • Infrastructure
        • Identity Providers
        • Hardware
      • API
      • Python SDK
    • User Manuals
      • Data Library
      • Visualisation
        • Add Data Sets
        • Signal List
        • Functions
        • Plot types
          • Time Series
            • Signal Settings
            • Limits and Stacking
            • Zooming
            • Cursors
            • Text data
          • Scatter
          • Map
          • Frequency (FFT)
          • Aggregates
        • Mouse Actions
        • Tabs
        • Reorganise Plots
        • Compare data
        • Realtime
        • Export image
      • Motorsport Package
      • Flight Testing Package
      • Projects
      • Sharing
      • Team and accounts
        • Workspaces
        • Account Types
      • Keyboard Shortcuts
  • Marple Files
    • Welcome
      • What is Marple Files?
      • Quick Start
      • FAQ
      • Release Notes
    • User Manuals
      • Data
        • File Types
        • Time Precision
        • Data Points
        • Upload Data
        • Organise Data
        • Influx DB
      • Visualisation
        • Overview
        • Plot types
        • Mouse & Keyboard
        • Calculated Signals
        • Overlay Data Sets
        • Projects
        • Annotations
      • Analysis
        • Metric Builder
        • SQL Editor
        • Marple AI (GPT)
      • Reporting
        • Create Reports
        • View Reports
        • Share Reports
        • From data library to reports
      • Sharing and Accounts
        • Sharing
        • Team
        • Settings
      • For developers
        • API Access Tokens
        • API Guide
        • Python
Powered by GitBook
On this page
  1. Marple Files
  2. User Manuals
  3. For developers

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')
path = '/example/test.csv' # path to the file in the Marple library
m.post(
  '/library/file/import', 
  json={'path': path, 'plugin': plugin, 'config': {'common': [{'name': 'time_offset', 'value': time_offset}]}}
)

Depending on the size of the dataset, importing can take a while. To check the import status:

The returned status is a number in [0, 100], representing the progress of the import in %. 100 means the import has finished.

status = m.check_import_status(source_id)

Negative status codes inform you about the following events:

  • -3 = Finalising, Marple is improving its cache to make the file faster

  • -2 = Waiting in the importing queue

  • -1 = Failed, something went wrong. Check the UI for more details about the error message

PreviousAPI Guide

Last updated 8 months ago

Once your data is uploaded, it needs to be imported. During importing, Marple will efficiently store the data, to enable fast visualisation later on. you can find more info about the available plugins and there config settings.

More details can be found at

https://pypi.org/project/marpledata
Here