PyTimbr


NamePyTimbr JSON
Version 1.0.0 PyPI version JSON
download
home_pagehttps://github.com/WPSemantix/timbr_python_connector
SummaryTimbr Python connector
upload_time2023-06-13 14:50:43
maintainer
docs_urlNone
authortimbr
requires_python
licenseMIT
keywords timbr timbr-python timbr-connector python-connector pytimbr pytimbr py-timbr py-timbr
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ![Timbr logo description](Timbr_logo.png)

# timbr Python connector sample file
This project is a sample connecting to timbr using Python.

## Dependencies
- Python 3.7.13+ or 3.8.x or 3.9.x
- Java 8 or Java 11

## Installation
Install as clone repository:
- Install Python: https://www.python.org/downloads/release/python-3713/
- Install Java: https://www.oracle.com/il-en/java/technologies/javase/jdk11-archive-downloads.html
- Run the following command to install the Python dependencies: `pip install -r requirements.txt`  (optional install pandas to run pandas example)
- Download the following jar to `jars` path: https://repo1.maven.org/maven2/org/apache/hive/hive-jdbc/2.3.9/hive-jdbc-2.3.9-standalone.jar

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

## Sample usage
- For an example of how to use the Python connector for Timbr, follow this [Example file](example.py) 
- For an example of using the Timbr Python connector with Pandas:
  - Make sure you have the pandas library installed, or you can install it by running `pip install pandas`
  - Follow this [Pandas Example File](pandas_example.py)

## Create basic connection 

### Create JDBC connection
```python

  # username - Use 'token' as the username when connecting using a Timbr token, otherwise its the user name.
  username = '<TIMBR_USER>'
  # userpass - Should be the token value if using a token as a username, otherwise its the user's password.
  userpass = '<TIMBR_PASSWORD>'
  # hostname - The IP / Hostname of the Timbr server (not necessarily the hostname of the Timbr platform).
  hostname = '<TIMBR_IP/HOST>'
  # port - Timbr default port 11000
  port = '<TIMBR_PORT>'
  # ontology - the ontology / knowledge graph to connect to.
  ontology = '<ONTOLOGY_NAME>'
  # enabled_ssl - Change to true if SSL is enabled.
  enabled_ssl = 'false'
  
  # Create new JDBC connection
  conn = PyTimbr.getJdbcConnection(f"jdbc:hive2://{hostname}:{port}/{ontology};transportMode=http;ssl={enabled_ssl};httpPath=/timbr-server", username, userpass)

  # Use the connection to execute a query
  with conn.cursor() as curs:
      # Execute query
      curs.execute('SHOW CONCEPTS')
      # Fetch results
      concepts = curs.fetchall()
      # Print the results
      for concept in concepts:
          print(concept)
```

### Create connection with params
```python
  # username - Use 'token' as the username when connecting using a Timbr token, otherwise its the user name.
  # userpass - Should be the token value if using a token as a username, otherwise its the user's password.
  # hostname - The IP / Hostname of the Timbr server (not necessarily the hostname of the Timbr platform).
  # port - Timbr default port 11000
  # ontology - the ontology / knowledge graph to connect to.
  # enabled_ssl - Change to true if SSL is enabled.
  conn = PyTimbr.getConnection(hostname='<TIMBR_IP/HOST>', port='<TIMBR_PORT>', ontology='<ONTOLOGY_NAME>', username='<TIMBR_USER>', password='<TIMBR_PASSWORD>', enabled_ssl='false')

  # Use the connection to execute a query
  with conn.cursor() as curs:
      # Execute query
      curs.execute('SHOW CONCEPTS')
      # Fetch results
      concepts = curs.fetchall()
      # Print the results
      for concept in concepts:
          print(concept)
```


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/WPSemantix/timbr_python_connector",
    "name": "PyTimbr",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "timbr,timbr-python,timbr-connector,python-connector,PyTimbr,pytimbr,py-timbr,Py-Timbr",
    "author": "timbr",
    "author_email": "contact@timbr.ai",
    "download_url": "https://files.pythonhosted.org/packages/98/2b/56ec1f4eda605a7373ff40bae8fd785016c0130e378342b225a8063986fb/PyTimbr-1.0.0.tar.gz",
    "platform": null,
    "description": "![Timbr logo description](Timbr_logo.png)\r\n\r\n# timbr Python connector sample file\r\nThis project is a sample connecting to timbr using Python.\r\n\r\n## Dependencies\r\n- Python 3.7.13+ or 3.8.x or 3.9.x\r\n- Java 8 or Java 11\r\n\r\n## Installation\r\nInstall as clone repository:\r\n- Install Python: https://www.python.org/downloads/release/python-3713/\r\n- Install Java: https://www.oracle.com/il-en/java/technologies/javase/jdk11-archive-downloads.html\r\n- Run the following command to install the Python dependencies: `pip install -r requirements.txt`  (optional install pandas to run pandas example)\r\n- Download the following jar to `jars` path: https://repo1.maven.org/maven2/org/apache/hive/hive-jdbc/2.3.9/hive-jdbc-2.3.9-standalone.jar\r\n\r\nInstall using pip and git:\r\n- `pip install git+https://github.com/WPSemantix/timbr_python_connector`\r\n\r\n## Sample usage\r\n- For an example of how to use the Python connector for Timbr, follow this [Example file](example.py) \r\n- For an example of using the Timbr Python connector with Pandas:\r\n  - Make sure you have the pandas library installed, or you can install it by running `pip install pandas`\r\n  - Follow this [Pandas Example File](pandas_example.py)\r\n\r\n## Create basic connection \r\n\r\n### Create JDBC connection\r\n```python\r\n\r\n  # username - Use 'token' as the username when connecting using a Timbr token, otherwise its the user name.\r\n  username = '<TIMBR_USER>'\r\n  # userpass - Should be the token value if using a token as a username, otherwise its the user's password.\r\n  userpass = '<TIMBR_PASSWORD>'\r\n  # hostname - The IP / Hostname of the Timbr server (not necessarily the hostname of the Timbr platform).\r\n  hostname = '<TIMBR_IP/HOST>'\r\n  # port - Timbr default port 11000\r\n  port = '<TIMBR_PORT>'\r\n  # ontology - the ontology / knowledge graph to connect to.\r\n  ontology = '<ONTOLOGY_NAME>'\r\n  # enabled_ssl - Change to true if SSL is enabled.\r\n  enabled_ssl = 'false'\r\n  \r\n  # Create new JDBC connection\r\n  conn = PyTimbr.getJdbcConnection(f\"jdbc:hive2://{hostname}:{port}/{ontology};transportMode=http;ssl={enabled_ssl};httpPath=/timbr-server\", username, userpass)\r\n\r\n  # Use the connection to execute a query\r\n  with conn.cursor() as curs:\r\n      # Execute query\r\n      curs.execute('SHOW CONCEPTS')\r\n      # Fetch results\r\n      concepts = curs.fetchall()\r\n      # Print the results\r\n      for concept in concepts:\r\n          print(concept)\r\n```\r\n\r\n### Create connection with params\r\n```python\r\n  # username - Use 'token' as the username when connecting using a Timbr token, otherwise its the user name.\r\n  # userpass - Should be the token value if using a token as a username, otherwise its the user's password.\r\n  # hostname - The IP / Hostname of the Timbr server (not necessarily the hostname of the Timbr platform).\r\n  # port - Timbr default port 11000\r\n  # ontology - the ontology / knowledge graph to connect to.\r\n  # enabled_ssl - Change to true if SSL is enabled.\r\n  conn = PyTimbr.getConnection(hostname='<TIMBR_IP/HOST>', port='<TIMBR_PORT>', ontology='<ONTOLOGY_NAME>', username='<TIMBR_USER>', password='<TIMBR_PASSWORD>', enabled_ssl='false')\r\n\r\n  # Use the connection to execute a query\r\n  with conn.cursor() as curs:\r\n      # Execute query\r\n      curs.execute('SHOW CONCEPTS')\r\n      # Fetch results\r\n      concepts = curs.fetchall()\r\n      # Print the results\r\n      for concept in concepts:\r\n          print(concept)\r\n```\r\n\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Timbr Python connector",
    "version": "1.0.0",
    "project_urls": {
        "Bug Tracker": "https://github.com/WPSemantix/timbr_python_connector/issues",
        "Download": "https://github.com/WPSemantix/timbr_python_connector/archive/refs/tags/v1.0.0.tar.gz",
        "Homepage": "https://github.com/WPSemantix/timbr_python_connector"
    },
    "split_keywords": [
        "timbr",
        "timbr-python",
        "timbr-connector",
        "python-connector",
        "pytimbr",
        "pytimbr",
        "py-timbr",
        "py-timbr"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "982b56ec1f4eda605a7373ff40bae8fd785016c0130e378342b225a8063986fb",
                "md5": "523f6c93df720ada1ea873369b1d0913",
                "sha256": "9db50b366bb33e91e060c1feb0ba49943cd7ebd8bdf9f3acadf70bb7a2bdf4ac"
            },
            "downloads": -1,
            "filename": "PyTimbr-1.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "523f6c93df720ada1ea873369b1d0913",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 53320366,
            "upload_time": "2023-06-13T14:50:43",
            "upload_time_iso_8601": "2023-06-13T14:50:43.854812Z",
            "url": "https://files.pythonhosted.org/packages/98/2b/56ec1f4eda605a7373ff40bae8fd785016c0130e378342b225a8063986fb/PyTimbr-1.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-06-13 14:50:43",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "WPSemantix",
    "github_project": "timbr_python_connector",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "pytimbr"
}
        
Elapsed time: 0.09590s