pytimbr-sqla


Namepytimbr-sqla JSON
Version 2.1.0 PyPI version JSON
download
home_pageNone
SummaryTimbr Python SQLAlchemy connector
upload_time2025-07-31 11:11:43
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseNone
keywords timbr timbr-python timbr-connector python-connector pytimbr pytimbr py-timbr py-timbr pytimbr_sqla pytimbr_sqla pytimbr_sqla pytimbr_sqla pytimbr_sqla pytimbr_sqla pytimbr_sqla pytimbr_sqla pytimbr_sqla pytimbrsqlalchemy pytimbrsqlalchemy pytimbrsqlalchemy pytimbrsqlalchemy pytimbrsqlalchemy py-timbrsqlalchemy py-timbrsqlalchemy py-timbr-sqlalchemy py-timbr-sqlalchemy
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ![Timbr logo](https://timbr.ai/wp-content/uploads/2025/01/logotimbrai230125.png)

[![FOSSA Status](https://app.fossa.com/api/projects/custom%2B50508%2Fgithub.com%2FWPSemantix%2Ftimbr_python_SQLAlchemy.svg?type=shield&issueType=license)](https://app.fossa.com/projects/custom%2B50508%2Fgithub.com%2FWPSemantix%2Ftimbr_python_SQLAlchemy?ref=badge_shield&issueType=license)
[![FOSSA Status](https://app.fossa.com/api/projects/custom%2B50508%2Fgithub.com%2FWPSemantix%2Ftimbr_python_SQLAlchemy.svg?type=shield&issueType=security)](https://app.fossa.com/projects/custom%2B50508%2Fgithub.com%2FWPSemantix%2Ftimbr_python_SQLAlchemy?ref=badge_shield&issueType=security)

[![Python 3.9](https://img.shields.io/badge/python-3.9-blue.svg)](https://www.python.org/downloads/release/python-3921/)
[![Python 3.10](https://img.shields.io/badge/python-3.10-blue.svg)](https://www.python.org/downloads/release/python-31017/)
[![Python 3.11](https://img.shields.io/badge/python-3.11-blue.svg)](https://www.python.org/downloads/release/python-31112/)
[![Python 3.12](https://img.shields.io/badge/python-3.12-blue.svg)](https://www.python.org/downloads/release/python-3129/)

[![PypiVersion](https://img.shields.io/pypi/v/pytimbr-sqla.svg)](https://badge.fury.io/py/pytimbr-sqla)

# timbr Python connector using SQLAlchemy
This project is a python connector to timbr using SQLAlchemy.

## Dependencies
- Access to a timbr-server
- Python from 3.9.13 or newer
- Support SQLAlchemy 1.4.36 or newer but not version 2.x yet.
- For <b>Linux</b> based machines only install those dependencies first:
  - gcc
  - heimdal-dev
  - krb5
  - python-devel
  - python-dev
  - python-all-dev
  - libsasl2-dev
- Ubuntu example:
  - apt install gcc, heimdal-dev, krb5, python-devel, python-dev, python-all-dev, libsasl2-dev

## Installation
- Install as clone repository:
  - Install Python: https://www.python.org/downloads/release/python-3913/
  - Run the following command to install the Python dependencies: `pip install -r requirements.txt`

- Install using pip and git:
  - `pip install git+https://github.com/WPSemantix/timbr_python_SQLAlchemy`

- Install using pip:
  - `pip install pytimbr-sqla`

## Sample usage
- For an example of how to use the Python SQLAlchemy connector for timbr, follow this [example file](examples/example.py)
- For an example of how to use the Python SQLAlchemy connector with 'PyHive' as async query for timbr, follow this [example file](examples/pyhive_async_example.py)
- For an example of how to use the Python SQLAlchemy connector with 'PyHive' as sync query for timbr, follow this [example file](examples/pyhive_sync_example.py)

## Connection parameters

### General example
```python
  hostname = '<TIMBR_IP/HOST>'
  port = '<TIMBR_PORT>'
  ontology = '<ONTOLOGY_NAME>'
  protocol = '<http/https>'
  username = '<TIMBR_USER/token>'
  password = '<TIMBR_PASSWORD/TOKEN_VALUE>'

  # hostname - The IP / Hostname of the Timbr server (not necessarily the hostname of the Timbr platform).
  # port - The port to connect to in the Timbr server. Timbr's default port with enabled_ssl is 443 without SSL is 11000.
  # ontology = The name of the ontology (knowledge graph) to connect.
  # protocol - Connection protocol can be 'http' or 'https'.
  # username - Use 'token' as the username when connecting using a Timbr token, otherwise use the user name.
  # password - If using a token as a username then the pass is the token value, otherwise its the user's password.
```

### HTTP example with dummy data

#### Username and password
```python
  hostname = 'mytimbrenv.com'
  port = '11000'
  ontology = 'my_ontology'
  protocol = 'http'
  username = 'timbr'
  password = 'StrongPassword'
```

#### Timbr token
```python
  hostname = 'mytimbrenv.com'
  port = '11000'
  ontology = 'my_ontology'
  protocol = 'http'
  username = 'token'
  password = '<TOKEN_VALUE>'
```

### HTTPS example with dummy data

#### Username and password
```python
  hostname = 'mytimbrenv.com'
  port = '443'
  ontology = 'my_ontology'
  protocol = 'https'
  username = 'timbr'
  password = 'StrongPassword'
```

#### Timbr token
```python
  hostname = 'mytimbrenv.com'
  port = '443'
  ontology = 'my_ontology'
  protocol = 'https'
  username = 'token'
  password = '<TOKEN_VALUE>'
```
## Connect options

### Connect using 'pytimbr_sqla' and 'SQLAlchemy' packages
```python
  from sqlalchemy import create_engine

  # Declare the connection variables
  # General example
  hostname = '<TIMBR_IP/HOST>'
  port = '<TIMBR_PORT>'
  ontology = '<ONTOLOGY_NAME>'
  protocol = '<http/https>'
  username = '<TIMBR_USER/token>'
  password = '<TIMBR_PASSWORD/TOKEN_VALUE>'

  # hostname - The IP / Hostname of the Timbr server (not necessarily the hostname of the Timbr platform).
  # port - The port to connect to in the Timbr server. Timbr's default port with enabled_ssl is 443 without SSL is 11000.
  # ontology = The name of the ontology (knowledge graph) to connect.
  # protocol - Connection protocol can be 'http' or 'https'.
  # username - Use 'token' as the username when connecting using a Timbr token, otherwise use the user name.
  # password - If using a token as a username then the pass is the token value, otherwise its the user's password.

  # Create new sqlalchemy connection
  engine = create_engine(f"timbr+{protocol}://{username}@{ontology}:{password}@{hostname}:{port}")

  # Connect to the created engine
  conn = engine.connect()

  # Execute a query
  query = "SHOW CONCEPTS"
  res_obj = conn.execute(query)
  results_headers = [(desc[0], desc[1]) for desc in res_obj.cursor.description]

  # Optional Performance Tuning:
  # By default, Timbr fetches results in batches of 10,000 rows at a time.
  # You can increase this batch size for better performance with large datasets.
  # Note: The maximum batch size is controlled by your Timbr server's 
  # "TIMBR_RESULTSET_MAX_FETCH_SIZE" configuration setting.
  res_obj.cursor._arraysize = 20000

  results = res_obj.fetchall()

  # Print the columns name
  for name, col_type in results_headers:
    print(f"{name} - {col_type}")
  # Print the results
  for result in results:
    print(result)
```
### Attention:
### timbr works only as async when running a query, if you want to use standard PyHive you have two options

### Connect using 'PyHive' and 'SQLAlchemy' packages

#### Connect using PyHive Async Query
```python
  from sqlalchemy import create_engine
  from TCLIService.ttypes import TOperationState

  # Declare the connection variables
  # General example
  hostname = '<TIMBR_IP/HOST>'
  port = '<TIMBR_PORT>'
  ontology = '<ONTOLOGY_NAME>'
  protocol = '<http/https>'
  username = '<TIMBR_USER/token>'
  password = '<TIMBR_PASSWORD/TOKEN_VALUE>'
  connect_args = {
    'configuration': {
      'set:hiveconf:hiveMetadata': 'true',
      'set:hiveconf:active_datasource': '<datasource_name>',
      'set:hiveconf:queryTimeout': '<TIMEOUT_IN_SECONDS>',
    },
  }

  # hostname - The IP / Hostname of the Timbr server (not necessarily the hostname of the Timbr platform).
  # port - The port to connect to in the Timbr server. Timbr's default port with enabled_ssl is 443 without SSL is 11000.
  # ontology = The name of the ontology (knowledge graph) to connect.
  # protocol - Connection protocol can be 'http' or 'https'.
  # username - Use 'token' as the username when connecting using a Timbr token, otherwise use the user name.
  # password - If using a token as a username then the pass is the token value, otherwise its the user's password.
  # connect_args - The connection special arguments for extra customization. The only argument you must have is the first one (set:hiveconf:hiveMetadata) the others are optional.

  # Create new sqlalchemy connection
  engine = create_engine(f"hive+{protocol}://{username}@{ontology}:{password}@{hostname}:{port}", connect_args = connect_args)

  # Connect to the created engine
  conn = engine.connect()
  dbapi_conn = engine.raw_connection()
  cursor = dbapi_conn.cursor()

  # Execute a query
  query = "SHOW CONCEPTS"
  cursor.execute(query)

  # Check the status of this execution
  status = cursor.poll().operationState
  while status in (TOperationState.INITIALIZED_STATE, TOperationState.RUNNING_STATE):
    status = cursor.poll().operationState

  # Get the results of the execution
  results_headers = [(desc[0], desc[1]) for desc in cursor.description]
  results = cursor.fetchall()

  # Display the results of the execution
  # Print the columns name
  for name, col_type in results_headers:
    print(f"{name} - {col_type}")
  # Print the results
  for result in results:
    print(result)
```

#### Connect using PyHive Sync Query
```python
  from sqlalchemy import create_engine
  from TCLIService.ttypes import TOperationState

  # Declare the connection variables
  # General example
  hostname = '<TIMBR_IP/HOST>'
  port = '<TIMBR_PORT>'
  ontology = '<ONTOLOGY_NAME>'
  protocol = '<http/https>'
  username = '<TIMBR_USER/token>'
  password = '<TIMBR_PASSWORD/TOKEN_VALUE>'
  connect_args = {
    'configuration': {
      'set:hiveconf:async': 'false',
      'set:hiveconf:hiveMetadata': 'true',
      'set:hiveconf:active_datasource': '<datasource_name>',
      'set:hiveconf:queryTimeout': '<TIMEOUT_IN_SECONDS>',
    },
  }

  # hostname - The IP / Hostname of the Timbr server (not necessarily the hostname of the Timbr platform).
  # port - The port to connect to in the Timbr server. Timbr's default port with enabled_ssl is 443 without SSL is 11000.
  # ontology = The name of the ontology (knowledge graph) to connect.
  # protocol - Connection protocol can be 'http' or 'https'.
  # username - Use 'token' as the username when connecting using a Timbr token, otherwise use the user name.
  # password - If using a token as a username then the pass is the token value, otherwise its the user's password.
  # connect_args - The connection special arguments for extra customization. The only 2 arguments you must have are the first and the second one (set:hiveconf:async, set:hiveconf:hiveMetadata) the others are optional.

  # Create new sqlalchemy connection
  engine = create_engine(f"hive+{protocol}://{username}@{ontology}:{password}@{hostname}:{port}", connect_args = connect_args)

  # Connect to the created engine
  conn = engine.connect()

  # Execute a query
  query = "SHOW CONCEPTS"
  res_obj = conn.execute(query)
  results_headers = [(desc[0], desc[1]) for desc in res_obj.cursor.description]
  results = res_obj.fetchall()

  # Print the columns name
  for name, col_type in results_headers:
    print(f"{name} - {col_type}")
  # Print the results
  for result in results:
    print(result)
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pytimbr-sqla",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "timbr <contact@timbr.ai>",
    "keywords": "timbr, timbr-python, timbr-connector, python-connector, PyTimbr, pytimbr, py-timbr, Py-Timbr, pytimbr_sqla, pytimbr_Sqla, PyTimbr_Sqla, pytimbr_SQla, PyTimbr_SQla, pytimbr_SQLa, PyTimbr_SQLa, pytimbr_SQlA, PyTimbr_SQLA, pytimbrsqlalchemy, PyTimbrSqlalchemy, PyTimbrSQlalchemy, PyTimbrSQLalchemy, PyTimbrSQLAlchemy, Py-TimbrSQLAlchemy, py-timbrsqlalchemy, Py-Timbr-SQLAlchemy, py-timbr-sqlalchemy",
    "author": null,
    "author_email": "timbr <contact@timbr.ai>",
    "download_url": "https://files.pythonhosted.org/packages/c6/68/a28257cb939e9fb99ff662c2e22a947a28e83ace81914ff44e662e08d8ec/pytimbr_sqla-2.1.0.tar.gz",
    "platform": null,
    "description": "![Timbr logo](https://timbr.ai/wp-content/uploads/2025/01/logotimbrai230125.png)\r\n\r\n[![FOSSA Status](https://app.fossa.com/api/projects/custom%2B50508%2Fgithub.com%2FWPSemantix%2Ftimbr_python_SQLAlchemy.svg?type=shield&issueType=license)](https://app.fossa.com/projects/custom%2B50508%2Fgithub.com%2FWPSemantix%2Ftimbr_python_SQLAlchemy?ref=badge_shield&issueType=license)\r\n[![FOSSA Status](https://app.fossa.com/api/projects/custom%2B50508%2Fgithub.com%2FWPSemantix%2Ftimbr_python_SQLAlchemy.svg?type=shield&issueType=security)](https://app.fossa.com/projects/custom%2B50508%2Fgithub.com%2FWPSemantix%2Ftimbr_python_SQLAlchemy?ref=badge_shield&issueType=security)\r\n\r\n[![Python 3.9](https://img.shields.io/badge/python-3.9-blue.svg)](https://www.python.org/downloads/release/python-3921/)\r\n[![Python 3.10](https://img.shields.io/badge/python-3.10-blue.svg)](https://www.python.org/downloads/release/python-31017/)\r\n[![Python 3.11](https://img.shields.io/badge/python-3.11-blue.svg)](https://www.python.org/downloads/release/python-31112/)\r\n[![Python 3.12](https://img.shields.io/badge/python-3.12-blue.svg)](https://www.python.org/downloads/release/python-3129/)\r\n\r\n[![PypiVersion](https://img.shields.io/pypi/v/pytimbr-sqla.svg)](https://badge.fury.io/py/pytimbr-sqla)\r\n\r\n# timbr Python connector using SQLAlchemy\r\nThis project is a python connector to timbr using SQLAlchemy.\r\n\r\n## Dependencies\r\n- Access to a timbr-server\r\n- Python from 3.9.13 or newer\r\n- Support SQLAlchemy 1.4.36 or newer but not version 2.x yet.\r\n- For <b>Linux</b> based machines only install those dependencies first:\r\n  - gcc\r\n  - heimdal-dev\r\n  - krb5\r\n  - python-devel\r\n  - python-dev\r\n  - python-all-dev\r\n  - libsasl2-dev\r\n- Ubuntu example:\r\n  - apt install gcc, heimdal-dev, krb5, python-devel, python-dev, python-all-dev, libsasl2-dev\r\n\r\n## Installation\r\n- Install as clone repository:\r\n  - Install Python: https://www.python.org/downloads/release/python-3913/\r\n  - Run the following command to install the Python dependencies: `pip install -r requirements.txt`\r\n\r\n- Install using pip and git:\r\n  - `pip install git+https://github.com/WPSemantix/timbr_python_SQLAlchemy`\r\n\r\n- Install using pip:\r\n  - `pip install pytimbr-sqla`\r\n\r\n## Sample usage\r\n- For an example of how to use the Python SQLAlchemy connector for timbr, follow this [example file](examples/example.py)\r\n- For an example of how to use the Python SQLAlchemy connector with 'PyHive' as async query for timbr, follow this [example file](examples/pyhive_async_example.py)\r\n- For an example of how to use the Python SQLAlchemy connector with 'PyHive' as sync query for timbr, follow this [example file](examples/pyhive_sync_example.py)\r\n\r\n## Connection parameters\r\n\r\n### General example\r\n```python\r\n  hostname = '<TIMBR_IP/HOST>'\r\n  port = '<TIMBR_PORT>'\r\n  ontology = '<ONTOLOGY_NAME>'\r\n  protocol = '<http/https>'\r\n  username = '<TIMBR_USER/token>'\r\n  password = '<TIMBR_PASSWORD/TOKEN_VALUE>'\r\n\r\n  # hostname - The IP / Hostname of the Timbr server (not necessarily the hostname of the Timbr platform).\r\n  # port - The port to connect to in the Timbr server. Timbr's default port with enabled_ssl is 443 without SSL is 11000.\r\n  # ontology = The name of the ontology (knowledge graph) to connect.\r\n  # protocol - Connection protocol can be 'http' or 'https'.\r\n  # username - Use 'token' as the username when connecting using a Timbr token, otherwise use the user name.\r\n  # password - If using a token as a username then the pass is the token value, otherwise its the user's password.\r\n```\r\n\r\n### HTTP example with dummy data\r\n\r\n#### Username and password\r\n```python\r\n  hostname = 'mytimbrenv.com'\r\n  port = '11000'\r\n  ontology = 'my_ontology'\r\n  protocol = 'http'\r\n  username = 'timbr'\r\n  password = 'StrongPassword'\r\n```\r\n\r\n#### Timbr token\r\n```python\r\n  hostname = 'mytimbrenv.com'\r\n  port = '11000'\r\n  ontology = 'my_ontology'\r\n  protocol = 'http'\r\n  username = 'token'\r\n  password = '<TOKEN_VALUE>'\r\n```\r\n\r\n### HTTPS example with dummy data\r\n\r\n#### Username and password\r\n```python\r\n  hostname = 'mytimbrenv.com'\r\n  port = '443'\r\n  ontology = 'my_ontology'\r\n  protocol = 'https'\r\n  username = 'timbr'\r\n  password = 'StrongPassword'\r\n```\r\n\r\n#### Timbr token\r\n```python\r\n  hostname = 'mytimbrenv.com'\r\n  port = '443'\r\n  ontology = 'my_ontology'\r\n  protocol = 'https'\r\n  username = 'token'\r\n  password = '<TOKEN_VALUE>'\r\n```\r\n## Connect options\r\n\r\n### Connect using 'pytimbr_sqla' and 'SQLAlchemy' packages\r\n```python\r\n  from sqlalchemy import create_engine\r\n\r\n  # Declare the connection variables\r\n  # General example\r\n  hostname = '<TIMBR_IP/HOST>'\r\n  port = '<TIMBR_PORT>'\r\n  ontology = '<ONTOLOGY_NAME>'\r\n  protocol = '<http/https>'\r\n  username = '<TIMBR_USER/token>'\r\n  password = '<TIMBR_PASSWORD/TOKEN_VALUE>'\r\n\r\n  # hostname - The IP / Hostname of the Timbr server (not necessarily the hostname of the Timbr platform).\r\n  # port - The port to connect to in the Timbr server. Timbr's default port with enabled_ssl is 443 without SSL is 11000.\r\n  # ontology = The name of the ontology (knowledge graph) to connect.\r\n  # protocol - Connection protocol can be 'http' or 'https'.\r\n  # username - Use 'token' as the username when connecting using a Timbr token, otherwise use the user name.\r\n  # password - If using a token as a username then the pass is the token value, otherwise its the user's password.\r\n\r\n  # Create new sqlalchemy connection\r\n  engine = create_engine(f\"timbr+{protocol}://{username}@{ontology}:{password}@{hostname}:{port}\")\r\n\r\n  # Connect to the created engine\r\n  conn = engine.connect()\r\n\r\n  # Execute a query\r\n  query = \"SHOW CONCEPTS\"\r\n  res_obj = conn.execute(query)\r\n  results_headers = [(desc[0], desc[1]) for desc in res_obj.cursor.description]\r\n\r\n  # Optional Performance Tuning:\r\n  # By default, Timbr fetches results in batches of 10,000 rows at a time.\r\n  # You can increase this batch size for better performance with large datasets.\r\n  # Note: The maximum batch size is controlled by your Timbr server's \r\n  # \"TIMBR_RESULTSET_MAX_FETCH_SIZE\" configuration setting.\r\n  res_obj.cursor._arraysize = 20000\r\n\r\n  results = res_obj.fetchall()\r\n\r\n  # Print the columns name\r\n  for name, col_type in results_headers:\r\n    print(f\"{name} - {col_type}\")\r\n  # Print the results\r\n  for result in results:\r\n    print(result)\r\n```\r\n### Attention:\r\n### timbr works only as async when running a query, if you want to use standard PyHive you have two options\r\n\r\n### Connect using 'PyHive' and 'SQLAlchemy' packages\r\n\r\n#### Connect using PyHive Async Query\r\n```python\r\n  from sqlalchemy import create_engine\r\n  from TCLIService.ttypes import TOperationState\r\n\r\n  # Declare the connection variables\r\n  # General example\r\n  hostname = '<TIMBR_IP/HOST>'\r\n  port = '<TIMBR_PORT>'\r\n  ontology = '<ONTOLOGY_NAME>'\r\n  protocol = '<http/https>'\r\n  username = '<TIMBR_USER/token>'\r\n  password = '<TIMBR_PASSWORD/TOKEN_VALUE>'\r\n  connect_args = {\r\n    'configuration': {\r\n      'set:hiveconf:hiveMetadata': 'true',\r\n      'set:hiveconf:active_datasource': '<datasource_name>',\r\n      'set:hiveconf:queryTimeout': '<TIMEOUT_IN_SECONDS>',\r\n    },\r\n  }\r\n\r\n  # hostname - The IP / Hostname of the Timbr server (not necessarily the hostname of the Timbr platform).\r\n  # port - The port to connect to in the Timbr server. Timbr's default port with enabled_ssl is 443 without SSL is 11000.\r\n  # ontology = The name of the ontology (knowledge graph) to connect.\r\n  # protocol - Connection protocol can be 'http' or 'https'.\r\n  # username - Use 'token' as the username when connecting using a Timbr token, otherwise use the user name.\r\n  # password - If using a token as a username then the pass is the token value, otherwise its the user's password.\r\n  # connect_args - The connection special arguments for extra customization. The only argument you must have is the first one (set:hiveconf:hiveMetadata) the others are optional.\r\n\r\n  # Create new sqlalchemy connection\r\n  engine = create_engine(f\"hive+{protocol}://{username}@{ontology}:{password}@{hostname}:{port}\", connect_args = connect_args)\r\n\r\n  # Connect to the created engine\r\n  conn = engine.connect()\r\n  dbapi_conn = engine.raw_connection()\r\n  cursor = dbapi_conn.cursor()\r\n\r\n  # Execute a query\r\n  query = \"SHOW CONCEPTS\"\r\n  cursor.execute(query)\r\n\r\n  # Check the status of this execution\r\n  status = cursor.poll().operationState\r\n  while status in (TOperationState.INITIALIZED_STATE, TOperationState.RUNNING_STATE):\r\n    status = cursor.poll().operationState\r\n\r\n  # Get the results of the execution\r\n  results_headers = [(desc[0], desc[1]) for desc in cursor.description]\r\n  results = cursor.fetchall()\r\n\r\n  # Display the results of the execution\r\n  # Print the columns name\r\n  for name, col_type in results_headers:\r\n    print(f\"{name} - {col_type}\")\r\n  # Print the results\r\n  for result in results:\r\n    print(result)\r\n```\r\n\r\n#### Connect using PyHive Sync Query\r\n```python\r\n  from sqlalchemy import create_engine\r\n  from TCLIService.ttypes import TOperationState\r\n\r\n  # Declare the connection variables\r\n  # General example\r\n  hostname = '<TIMBR_IP/HOST>'\r\n  port = '<TIMBR_PORT>'\r\n  ontology = '<ONTOLOGY_NAME>'\r\n  protocol = '<http/https>'\r\n  username = '<TIMBR_USER/token>'\r\n  password = '<TIMBR_PASSWORD/TOKEN_VALUE>'\r\n  connect_args = {\r\n    'configuration': {\r\n      'set:hiveconf:async': 'false',\r\n      'set:hiveconf:hiveMetadata': 'true',\r\n      'set:hiveconf:active_datasource': '<datasource_name>',\r\n      'set:hiveconf:queryTimeout': '<TIMEOUT_IN_SECONDS>',\r\n    },\r\n  }\r\n\r\n  # hostname - The IP / Hostname of the Timbr server (not necessarily the hostname of the Timbr platform).\r\n  # port - The port to connect to in the Timbr server. Timbr's default port with enabled_ssl is 443 without SSL is 11000.\r\n  # ontology = The name of the ontology (knowledge graph) to connect.\r\n  # protocol - Connection protocol can be 'http' or 'https'.\r\n  # username - Use 'token' as the username when connecting using a Timbr token, otherwise use the user name.\r\n  # password - If using a token as a username then the pass is the token value, otherwise its the user's password.\r\n  # connect_args - The connection special arguments for extra customization. The only 2 arguments you must have are the first and the second one (set:hiveconf:async, set:hiveconf:hiveMetadata) the others are optional.\r\n\r\n  # Create new sqlalchemy connection\r\n  engine = create_engine(f\"hive+{protocol}://{username}@{ontology}:{password}@{hostname}:{port}\", connect_args = connect_args)\r\n\r\n  # Connect to the created engine\r\n  conn = engine.connect()\r\n\r\n  # Execute a query\r\n  query = \"SHOW CONCEPTS\"\r\n  res_obj = conn.execute(query)\r\n  results_headers = [(desc[0], desc[1]) for desc in res_obj.cursor.description]\r\n  results = res_obj.fetchall()\r\n\r\n  # Print the columns name\r\n  for name, col_type in results_headers:\r\n    print(f\"{name} - {col_type}\")\r\n  # Print the results\r\n  for result in results:\r\n    print(result)\r\n```\r\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Timbr Python SQLAlchemy connector",
    "version": "2.1.0",
    "project_urls": {
        "Bug Tracker": "https://github.com/WPSemantix/timbr_python_SQLAlchemy/issues",
        "Documentation": "https://github.com/WPSemantix/timbr_python_SQLAlchemy#readme",
        "Download": "https://github.com/WPSemantix/timbr_python_SQLAlchemy/releases",
        "Homepage": "https://github.com/WPSemantix/timbr_python_SQLAlchemy",
        "Repository": "https://github.com/WPSemantix/timbr_python_SQLAlchemy"
    },
    "split_keywords": [
        "timbr",
        " timbr-python",
        " timbr-connector",
        " python-connector",
        " pytimbr",
        " pytimbr",
        " py-timbr",
        " py-timbr",
        " pytimbr_sqla",
        " pytimbr_sqla",
        " pytimbr_sqla",
        " pytimbr_sqla",
        " pytimbr_sqla",
        " pytimbr_sqla",
        " pytimbr_sqla",
        " pytimbr_sqla",
        " pytimbr_sqla",
        " pytimbrsqlalchemy",
        " pytimbrsqlalchemy",
        " pytimbrsqlalchemy",
        " pytimbrsqlalchemy",
        " pytimbrsqlalchemy",
        " py-timbrsqlalchemy",
        " py-timbrsqlalchemy",
        " py-timbr-sqlalchemy",
        " py-timbr-sqlalchemy"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "b3d631ddbddaff0d8da4db830155f5f939c2020763790b06c53bed15df7b35b0",
                "md5": "67c79cd77febfd40523d7dbb7e25ac8a",
                "sha256": "0c2f0b6c307e30723d26812fb1b34a020fa16193cd744268103cc18e1435813b"
            },
            "downloads": -1,
            "filename": "pytimbr_sqla-2.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "67c79cd77febfd40523d7dbb7e25ac8a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 101196,
            "upload_time": "2025-07-31T11:11:42",
            "upload_time_iso_8601": "2025-07-31T11:11:42.364304Z",
            "url": "https://files.pythonhosted.org/packages/b3/d6/31ddbddaff0d8da4db830155f5f939c2020763790b06c53bed15df7b35b0/pytimbr_sqla-2.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "c668a28257cb939e9fb99ff662c2e22a947a28e83ace81914ff44e662e08d8ec",
                "md5": "3ef391ddd40967921a35a449199ec5f7",
                "sha256": "747f41a12df465f1b330931d5cf5085c1eef485b3c9bfed328d88df08e732709"
            },
            "downloads": -1,
            "filename": "pytimbr_sqla-2.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "3ef391ddd40967921a35a449199ec5f7",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 100027,
            "upload_time": "2025-07-31T11:11:43",
            "upload_time_iso_8601": "2025-07-31T11:11:43.881690Z",
            "url": "https://files.pythonhosted.org/packages/c6/68/a28257cb939e9fb99ff662c2e22a947a28e83ace81914ff44e662e08d8ec/pytimbr_sqla-2.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-31 11:11:43",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "WPSemantix",
    "github_project": "timbr_python_SQLAlchemy",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "pytimbr-sqla"
}
        
Elapsed time: 1.03572s