Giter Site home page Giter Site logo

regadas / sqltools-trino-driver Goto Github PK

View Code? Open in Web Editor NEW
6.0 2.0 4.0 1.04 MB

SQLTools driver for Trino

Home Page: https://marketplace.visualstudio.com/items?itemName=regadas.sqltools-trino-driver

License: MIT License

TypeScript 96.81% JavaScript 3.19%
sqltools sqltools-driver trino trinodb vscode vscode-extension

sqltools-trino-driver's Introduction

ci license

SQLTools Trino Driver

Trino driver for VS Code SQLTools extension.

Installation

  • Directly from VS Code by searching @tag:sqltools trino or just trino;
  • From marketplace.

Usage

After installation you will be able to explore tables and views, run queries, etc. For more details see SQLTools documentation.

Contributing

Please open GitHub issues and pull requests.

sqltools-trino-driver's People

Contributors

dependabot[bot] avatar pmcfizz avatar regadas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

sqltools-trino-driver's Issues

When connecting/Testing a connection I am greeted with Connected but cannnot run SQL error

Error: Connected but cannot run SQL. [object Object]

OUTPUT Logs:

[1653506540092] INFO  (ext): EXECUTING COMMAND => sqltools.selectConnection
[1653506540093] INFO  (ext): EXECUTING COMMAND => sqltools.getConnections
[1653506540094] INFO  (ls): REQUEST RECEIVED => connection/GetConnectionsRequest
[1653506540095] INFO  (ext): EXECUTING COMMAND => sqltools.getConnections
[1653506540096] INFO  (ls): REQUEST RECEIVED => connection/GetConnectionsRequest
[1653506540099] INFO  (ls): REQUEST RECEIVED => connection/ConnectRequest
[1653506540099] INFO  (ls): Connection instance created for Red Hat Trino .
    ns: "conn-manager"
[1653506540142] ERROR (ls): Connecting error: {"code":-1,"data":{"driver":"Trino Driver","driverOptions":{}},"name":"DecoratedException"}
    ns: "conn-manager"
[1653506540144] ERROR (ext): ERROR: Error opening connection Connected but cannot run SQL. [object Object], {"code":-1,"data":{"driver":"Trino Driver","driverOptions":{}}}
    ns: "error-handler"

With the Trino CLI I can connect and run the same query that the trino driver runs.

./trino --password --server MY_HOST:443 --catalog MY_CATALOG --schema MY_SCHEMA
Password: *********************************************
trino:ccx> SELECT 1;
 _col0 
-------
     1 
(1 row)

Query 20220525_192611_27727_deky4, FINISHED, 1 node
Splits: 1 total, 1 done (100.00%)
0.27 [0 rows, 0B] [0 rows/s, 0B/s]

I suspect this may be authentication related? As the config for setting up a connection never asked me for a password (which I found odd). In looking at the code I don't see any auth settings defined in the configuration, and since we seem to be using preso, under the hood; it seem like providing a basic_auth field to the client might fix this?

Example:

    const connOptions = {
      host: this.credentials.host,
      port: this.credentials.port,
      catalog: this.credentials.catalog,
      schema: this.credentials.schema,
      user: this.credentials.user,
      basic_auth: {user: this.credentials.user, password: this.credentials.password}, 
      engine: "trino",
      source: "sqltools-driver",
    };

get all catalogs

Is there a way to get all catalogs and under it get the schemas?

400 Bad Request: The plain HTTP request was sent to HTTPS port

Hi I'm trying to setup the connection, but getting the below error .

execution error: <title>400 The plain HTTP request was sent to HTTPS port</title>

400 Bad Request

The plain HTTP request was sent to HTTPS port
AppleHttpServer/3cf2bca163d83e1139a9fb7d706140b63b127f62

Do you have some idea why this is happening? Enforce "https://" in the beginning of the host doesnt work

How to disable SSL verification

When trying to connect, I'm getting error message like ERROR: Error selecting connection unable to verify the first certificate.

Is there any way to disable SSL verification like the way in Python?
In Python, by just setting the argument to False like below, it's solved. (Reference)

from trino.dbapi import connect
from trino.auth import BasicAuthentication

conn = connect(
    user="<username>",
    auth=BasicAuthentication("<username>", "<password>"),
    http_scheme="https",
    verify=False
)

How to Specify CA bundle certificate

In a corp context, with a ca_bundle.pem file, can we add an SSL parameter to indicate and use that certificate?

Otherwise, I'm stuck with Error opening connection unable to get local issuer certificate.

How Does This Work

Hi. I'd like to use this. Unfortunately I cannot find any info on how to configure this exactly.

The below does not work with a locally running unsecured Trino:

      {
        "name": "Trino",
        "driver": "Trino Driver",
        "server": "http://localhost:8080",
        "username": "user"
      }

This only gives:

Error selecting connection Request failed with status code 401, {"code":-1,"data":{"driver":"Trino Driver","driverOptions":{}}}

Could someone please assist?

Can't open connection

Upon attempting to create a new connection for sqltools, I get the error below. For my connection I have name, server, port, username, password. Any ideas what I'm missing? The error doesn't help.

I do see this in the log, so it looks like the trino extension was installed OK:
INFO (ls): request to register plugin: "c:\Users\bwood.vscode\extensions\regadas.sqltools-trino-driver-0.2.9\out\ls\plugin.js"
INFO (ls): Driver trino driver registered!

TypeError: Cannot read properties of undefined (reading 'toLowerCase')
at DriverMap.has (c:\Users\bwood.vscode\extensions\mtxr.sqltools-0.27.0\dist\languageserver.js:1:668340)
at new Connection (c:\Users\bwood.vscode\extensions\mtxr.sqltools-0.27.0\dist\languageserver.js:1:664539)
at ConnectionManagerPlugin.openConnectionHandler (c:\Users\bwood.vscode\extensions\mtxr.sqltools-0.27.0\dist\languageserver.js:1:688109)
at async ConnectionManagerPlugin._autoConnectIfActive (c:\Users\bwood.vscode\extensions\mtxr.sqltools-0.27.0\dist\languageserver.js:1:693724)

Error opening connection self signed certificate

[1672905852639] INFO (ls): Connection instance created for trino.
ns: "conn-manager"
[1672905852648] ERROR (ls): Connecting error: {"code":-1,"data":{"driver":"Trino Driver","driverOptions":{}},"name":"DecoratedException"}
ns: "conn-manager"
[1672905852648] ERROR (ls): Open connection error
ns: "conn-manager"
[1672905852648] ERROR (ext): ERROR: Error opening connection self signed certificate, {"code":-1,"data":{"driver":"Trino Driver","driverOptions":{}}}
ns: "error-handler"

TypeError: Cannot read properties of undefined (reading 'total')

[1677558842306] ERROR (TypeError):
TypeError: Cannot read properties of undefined (reading 'total')
at Qr. (c:\Users\Administrator.vscode\extensions\regadas.sqltools-trino-driver-0.2.9\out\ls\plugin.js:116:5563)
at Generator.next ()
at o (c:\Users\Administrator.vscode\extensions\regadas.sqltools-trino-driver-0.2.9\out\ls\plugin.js:116:4100)
at process.processTicksAndRejections (node:internal/process/task_queues:96:5)
[1677558842307] ERROR (ext): ERROR: Execute query error Cannot read properties of undefined (reading 'total'), 'Cannot read properties of undefined (reading 'total')'
ns: "error-handler"
[1677558842314] ERROR (ext): ERROR: Error while showing table records Cannot read properties of undefined (reading 'total'), {"code":-1,"data":{"driver":"Trino Driver","driverOptions":{}}}
ns: "error-handler"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.