55[ ![ Formatting status] ( https://github.com/edgeandnode/amp-python/actions/workflows/ruff.yml/badge.svg?event=push )] ( https://github.com/edgeandnode/amp-python/actions/workflows/ruff.yml )
66
77
8- ## Overview
8+ ## Overview
99
10- Client for issuing queries to an Amp server and working with the returned data.
10+ Python client for Amp - a high-performance data infrastructure for blockchain data.
11+
12+ ** Features:**
13+ - ** Query Client** : Issue Flight SQL queries to Amp servers
14+ - ** Admin Client** : Manage datasets, deployments, and jobs programmatically
15+ - ** Data Loaders** : Zero-copy loading into PostgreSQL, Redis, Snowflake, Delta Lake, Iceberg, and more
16+ - ** Parallel Streaming** : High-throughput parallel data ingestion with automatic resume
17+ - ** Manifest Generation** : Fluent API for creating and deploying datasets from SQL queries
1118
1219## Installation
1320
@@ -21,7 +28,57 @@ Client for issuing queries to an Amp server and working with the returned data.
2128 uv venv
2229 ```
2330
24- ## Useage
31+ ## Quick Start
32+
33+ ### Querying Data
34+
35+ ``` python
36+ from amp import Client
37+
38+ # Connect to Amp server
39+ client = Client(url = " grpc://localhost:8815" )
40+
41+ # Execute query and convert to pandas
42+ df = client.query(" SELECT * FROM eth.blocks LIMIT 10" ).to_pandas()
43+ print (df)
44+ ```
45+
46+ ### Admin Operations
47+
48+ ``` python
49+ from amp import Client
50+
51+ # Connect with admin capabilities
52+ client = Client(
53+ query_url = " grpc://localhost:8815" ,
54+ admin_url = " http://localhost:8080" ,
55+ auth_token = " your-token"
56+ )
57+
58+ # Register and deploy a dataset
59+ job = (
60+ client.query(" SELECT block_num, hash FROM eth.blocks" )
61+ .with_dependency(
' eth' ,
' _/[email protected] ' )
62+ .register_as(' _' , ' my_dataset' , ' 1.0.0' , ' blocks' , ' mainnet' )
63+ .deploy(parallelism = 4 , end_block = ' latest' , wait = True )
64+ )
65+
66+ print (f " Deployment completed: { job.status} " )
67+ ```
68+
69+ ### Loading Data
70+
71+ ``` python
72+ # Load query results into PostgreSQL
73+ loader = client.query(" SELECT * FROM eth.blocks" ).load(
74+ loader_type = ' postgresql' ,
75+ connection = ' my_pg_connection' ,
76+ table_name = ' eth_blocks'
77+ )
78+ print (f " Loaded { loader.rows_written} rows " )
79+ ```
80+
81+ ## Usage
2582
2683### Marimo
2784
@@ -30,19 +87,23 @@ Start up a marimo workspace editor
3087uv run marimo edit
3188```
3289
33- The Marimo app will open a new browser tab where you can create a new notebook, view helpful resources, and
90+ The Marimo app will open a new browser tab where you can create a new notebook, view helpful resources, and
3491browse existing notebooks in the workspace.
3592
3693### Apps
3794
38- You can execute python apps and scripts using ` uv run <path> ` which will give them access to the dependencies
95+ You can execute python apps and scripts using ` uv run <path> ` which will give them access to the dependencies
3996and the ` amp ` package. For example, you can run the ` execute_query ` app with the following command.
4097``` bash
4198uv run apps/execute_query.py
4299```
43100
44101## Documentation
45102
103+ ### Getting Started
104+ - ** [ Admin Client Guide] ( docs/admin_client_guide.md ) ** - Complete guide for dataset management and deployment
105+ - ** [ Admin API Reference] ( docs/api/admin_api.md ) ** - Full API documentation for admin operations
106+
46107### Features
47108- ** [ Parallel Streaming Usage Guide] ( docs/parallel_streaming_usage.md ) ** - User guide for high-throughput parallel data loading
48109- ** [ Parallel Streaming Design] ( docs/parallel_streaming.md ) ** - Technical design documentation for parallel streaming architecture
0 commit comments