Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# e6data Python Connector

![version](https://img.shields.io/badge/version-1.0.10-blue.svg)
![version](https://img.shields.io/badge/version-1.1.0-blue.svg)

## Introduction

Expand All @@ -21,16 +21,17 @@ pip install e6data-python-connector
Use your e6data Email ID as the username and your access token as the password.

```python
import e6xdb.e6x as edb
from e6data_python_connector import Connection

username = '<username>' # Your e6data Email ID.
password = '<password>' # Access Token generated in the e6data console.

host = '<host>' # IP address or hostname of the cluster to be used.
database = '<database>' # # Database to perform the query on.
port = 9000 # Port of the e6data engine.
catalog_name = '<catalog_name>'

conn = edb.connect(
conn = Connection(
host=host,
port=port,
username=username,
Expand All @@ -45,7 +46,7 @@ conn = edb.connect(

query = 'SELECT * FROM <TABLE_NAME>' # Replace with the query.

cursor = conn.cursor()
cursor = conn.cursor(catalog_name=catalog_name)
query_id = cursor.execute(query) # The execute function returns a unique query ID, which can be use to abort the query.
all_records = cursor.fetchall()
for row in all_records:
Expand Down Expand Up @@ -91,15 +92,15 @@ cursor.cancel(query_id)
Switch database in an existing connection:
```python
database = '<new_database_name>' # Replace with the new database.
cursor = conn.cursor(database)
cursor = conn.cursor(database, catalog_name)
```

### Get Query Time Metrics
```python
import json
query = 'SELECT * FROM <TABLE_NAME>'

cursor = conn.cursor()
cursor = conn.cursor(catalog_name)
query_id = cursor.execute(query) # execute function returns query id, can be use for aborting th query.
all_records = cursor.fetchall()

Expand Down Expand Up @@ -159,6 +160,8 @@ port = 9000 # Port of the e6data engine.

sql_query = 'SELECT * FROM <TABLE_NAME>' # Replace with the actual query.

catalog_name = '<catalog_name>' # Replace with the actual catalog name.

conn = edb.connect(
host=host,
port=port,
Expand All @@ -167,7 +170,7 @@ conn = edb.connect(
password=password
)

cursor = conn.cursor(db_name=database)
cursor = conn.cursor(db_name=database, catalog_name=catalog_name)
query_id = cursor.execute(sql_query)
all_records = cursor.fetchall()
planner_result = json.loads(cursor.explain_analyse())
Expand Down
3 changes: 3 additions & 0 deletions e6data_python_connector/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from e6data_python_connector.e6xgrpc import Connection, Cursor

__all__ = ['Connection', 'Cursor']
Loading