---
title: Connect Using pyocient
slug: aNtoR8fut6_hSoLea-eID
description: Follow this guide to establish a Pyocient connection to the Ocient data warehouse, enabling Python-based data operations and analysis.
docTags: 
createdAt: Thu Jul 21 2022 17:05:13 GMT+0000 (Coordinated Universal Time)
updatedAt: Mon Mar 30 2026 18:52:46 GMT+0000 (Coordinated Universal Time)
---

The Ocient® Python® module `pyocient` supports direct connections to Ocient Systems in a Command-Line Interface (CLI) as well as in Python programs that follow the Python Database API Specification 2.0.&#x20;

After you install `pyocient`, you can establish Ocient connections to run queries and commands.

## Installation Tutorial

To install and run `pyocient`, follow these steps.&#x20;

:::::WorkflowBlock
::::WorkflowBlockItem
## Install pyocient

Install `pyocient` using pip.&#x20;

```shell
pip3 install pyocient
```

After running the pip install, `pyocient` is installed in the `bin` directory.

:::hint{type="info"}
Use `venv` to install `pyocient` using a virtual environment. For more information, see the Python [venv](https://docs.python.org/3/library/venv.html) documentation.&#x20;
:::
::::

::::WorkflowBlockItem
## Start pyocient

`pyocient` is started from the command line with a connection string. It includes many options to configure the connection and client similar to the JDBC driver. Learn more about supported options in the [Ocient Python Module: pyocient](<././Connection Driver Reference/Ocient Python Module_ pyocient.md>).&#x20;

After installation, you can launch from a command line by typing the `pyocient` command. &#x20;

```shell
pyocient ocient://example_user:example_password@10.10.1.1/system
```

To connect to the system database, replace the example username (`example_user`) and password (`example_password`) with your credentials, set your IP address,

The connection example assume a SQL Node exists at `10.10.1.1`. The example uses the default port `4050`, and is set up with default self-signed certificates for TLS.

**Example Response**

```SQL
Ocient Database™
System Version: <Ocient System Version>, Client Version <pyocient Version>
> _
```

:::hint{type="info"}
Use the command `quit;` to exit the `pyocient` CLI interface.&#x20;
:::
::::

:::WorkflowBlockItem
## Run a Query

In the `pyocient` CLI, you can run any SQL query supported by your database. In this example, a query is selecting rows from the system tables:

```sql
SELECT * FROM sys.tables;
```

You can also run queries from the command line with the connection string:&#x20;

```shell
pyocient ocient://example_user:example_password@10.10.1.1/system 'SELECT * from sys.tables'
```

**Example Response**

```SQL
[  
  {
        "id": "359e21b1-770a-4860-aec9-f158d307f725",
        "name": "data_type_coverage",
        "schema": "loading",
        "database_id": "f827ff7c-dd94-43bf-8386-93d048344a32",
        "storage_space_id": "2ad08e7c-15d1-4861-b38b-256c4df4a191",
        "maximum_segment_size_gib": 4,
        "description": null,
        "streamloader_property_string": null,
        "created_at": "2023-08-08T21:22:49.622213"
    }
]
```
:::
:::::

:::hint{type="info"}
The system cancels any queries made with the `pyocient` driver if you perform any of these actions:

- Fetch the entire result set.
- Close the connection.
- Execute a new query using the same connection.
:::

For more information and API reference material for pyocient, see the [Ocient Python Module: pyocient](<././Connection Driver Reference/Ocient Python Module_ pyocient.md>) page.&#x20;

## Related Links

[Connect to Ocient](<././Connect to Ocient.md>)

[Ocient Integrations](<./Ocient Integrations.md>)

