Skip to main content

SDK functions for users to query Data Solutions databases.

Project description

Welcome to the Chainalysis Data Solutions Python SDK

A modern python wrapper for the Chainalysis Data Solutions API Suite.

Documentation

See the latest documentation on all available classes and methods here.

Installation

To install the SDK, run the following command in bash.

pip install chainalysis

Getting Started

Get an API Key at our website by registering an account and navigating to settings in the data solutions product section.

Begin using the SDK with the code below as a sample. The following code snippet details how to import and instantiate the Data Solutions Client to then be used to execute two kinds of queries: Analytical and Transactional.

Analytical queries are queries targeting the data you can view under the 'Explore Data' tab in Data Solutions. Transactional queries are queries targeting data you can find at docs.transpose.io.

    # Import the module
    from chainalysis import DataSolutionsClient

    # Instantiate with an API Key
    ds = DataSolutionsClient({API_KEY})

    # Create an AnalyticalSelect object
    analytical_select = ds.orm.AnalyticalSelect("cross_chain.clusters")

    # Construct a query
    query = analytical_select.with_columns(
        analytical_select.c.cluster_id, analytical_select.c.entity_name
    ).where(
        analytical_select.c.address == "0x00703a0ce5406501c44ca657497c0f785e83dde0"
    ).limit(10)

    # Execute the query
    query_results = query.execute()

    # Print the results of the query as a json blob
    print(query_results.json())

    # Return the results of the query as a Pandas Dataframe
    dataframe = query_results.df()

    # OR construct an analytical query manually
    query = """
        SELECT * FROM cross_chain.clusters
        WHERE address = '0x00703a0ce5406501c44ca657497c0f785e83dde0'
        LIMIT 10;
    """

    # Execute the query
    query_results = ds.sql.analytical_query(
        query=query,
        polling_interval_sec=5, # How often to check if data is available yet
    )

Future

More details on our SDK incoming!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

data_solutions_test_library-0.0.7.tar.gz (550.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

data_solutions_test_library-0.0.7-py3-none-any.whl (23.4 kB view details)

Uploaded Python 3

File details

Details for the file data_solutions_test_library-0.0.7.tar.gz.

File metadata

File hashes

Hashes for data_solutions_test_library-0.0.7.tar.gz
Algorithm Hash digest
SHA256 b37321482d80b7a0a8bb295acbfd8ad0100b208f4b9367eefef4b6c4f9d022dd
MD5 8c7157ff91654d0cc3669a636f861174
BLAKE2b-256 bdb5c5d3c106ff98a88b0f80d161dd9db59648e379f5087bca9d34d1b35e7d96

See more details on using hashes here.

File details

Details for the file data_solutions_test_library-0.0.7-py3-none-any.whl.

File metadata

File hashes

Hashes for data_solutions_test_library-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 15ea1589d01551f43b16d5b154c6560addc43a2414267445cf1eec854b562d06
MD5 206921ded9230c54886b455d73d4e1f1
BLAKE2b-256 458752d54885bb6d35d0ab76e6b88215a0ecf25ec39067a2caae2abdf0e6c923

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page