sqlpad / sqlpad

Web-based SQL editor. Legacy project in maintenance mode.
https://getsqlpad.com
MIT License
5.05k stars 785 forks source link

HANA schema support #1003

Open MichaelTheriot opened 3 years ago

MichaelTheriot commented 3 years ago

Thanks for this tool. I am working with a HANA database. The schema browser showed a permission error for my database which I was able to resolve by updating the driver to use SYS.TABLE_COLUMNS instead of SYS.COLUMNS (https://help.sap.com/viewer/4fe29514fd584807ac9f2a04f6754767/2.0.03/en-US/a7142827fb2e4581991d3d84a3deaf15.html).

Should the schema browser show views as well as tables? I should be able to easily add them in by updating the same query.

Also, HANA allows quoted identifiers like a few other databases - are these supported? The auto-completion is not quoting these for me, but if they are supported I could generate a query that can provide this information to the driver. (i.e. if identifier is not uppercased, is a keyword, contains a space)

rickbergfalk commented 3 years ago

Sure! Views should be shown and if they aren't it is likely because they were missed in the original query. Would happily accept a PR to update the driver SQL used.

Quoted identifiers should work. The auto-completion is very basic and generic, so any limitation there shouldn't reflect on the underlying driver. Quoted identifiers support would be a good addition to auto-complete.

MichaelTheriot commented 3 years ago

I am still investigating, but it looks like the query select * from SYS.VIEWS crashes SQLPad server in my local environment.

It looks like the error originates from hdb, but I am able to run this query without error in a new project using the same version of the driver, so I am struggling to figure out why.

...\node_modules\hdb\lib\protocol\Connection.js:581
  return this._queue.empty && !this._queue.busy;
                     ^

TypeError: Cannot read property 'empty' of undefined