Python SDK for Apache Linkis
Project description
Linkis Python SDK
Python SDK for Apache Linkis, providing a simple interface to submit and manage jobs.
Installation
pip install linkis-python-sdk
Features
- User authentication
- Job submission and execution
- Job status monitoring
- Results retrieval (with pandas DataFrame support)
- Job termination
Quick Start
Submitting a Job and Getting Results
from linkis_python_sdk import LinkisClient
# Create a client
client = LinkisClient(
address="http://linkis-gateway:9001",
username="your-username",
password="your-password"
)
# Login
client.login()
# Submit a job and wait for results
result = client.execute(
code="SELECT * FROM my_table LIMIT 10",
run_type="sql",
engine_type="spark-2.4.3"
)
# Convert results to pandas DataFrame
df = client.get_result_dataframe(result)
print(df)
Killing a Running Job
from linkis_python_sdk import LinkisClient
# Create a client
client = LinkisClient(
address="http://linkis-gateway:9001",
username="your-username",
password="your-password"
)
# Login
client.login()
# Submit a job (don't wait)
result = client.execute(
code="SELECT * FROM my_big_table",
run_type="sql",
engine_type="spark-2.4.3",
wait=False
)
# Kill the job
client.kill_job(result['exec_id'])
API Documentation
LinkisClient
The main client class for interacting with Linkis.
Constructor
LinkisClient(
address: str,
token_key: str = None,
token_value: str = None,
username: str = None,
password: str = None,
timeout: int = 60,
api_version: str = "v1"
)
address: Linkis gateway address (e.g., "http://127.0.0.1:9001")token_key: Authentication token key (optional)token_value: Authentication token value (optional)username: Username for login (required if token not provided)password: Password for login (required if token not provided)timeout: Request timeout in secondsapi_version: API version to use
Methods
login(): Authenticate with Linkis serversubmit_job(code, run_type, engine_type, source, params): Submit a jobget_job_info(task_id): Get job status and informationget_job_results(task_id): Get result file pathsget_result_content(file_path): Get content of a result filekill_job(exec_id): Kill a running jobexecute(code, run_type, engine_type, source, params, wait, interval, timeout, callback): Submit and optionally wait for job completionget_result_dataframe(result): Convert execution result to pandas DataFrame
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
linkis_python_sdk-0.1.0.tar.gz
(12.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file linkis_python_sdk-0.1.0.tar.gz.
File metadata
- Download URL: linkis_python_sdk-0.1.0.tar.gz
- Upload date:
- Size: 12.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
55747c41d933c44dd264ed4a1ad2dd4a9485b72a4e43c6006f1a269c2f530193
|
|
| MD5 |
839255defd71a7e1acc381872e4e0ba2
|
|
| BLAKE2b-256 |
2f82196e306a8df7083158be2c61332c9d698cded1a2b8c7bd044700320469ca
|
File details
Details for the file linkis_python_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: linkis_python_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9e977e9cfaf4b2bc861dd4bbdbc5f306ebadfb645a920330e9f91fd36a4894ca
|
|
| MD5 |
d1335e4615e65f8bb13189cd29e5ebfe
|
|
| BLAKE2b-256 |
d280c9c1429fdc837f31d3b19b154bf10ea3b180c8bbb22144042e9616938dd2
|