Code Monkey home page Code Monkey logo

vscode-cassandra's Introduction

Cassandra workbench for Visual Studio Code

Visual Studio Marketplace Installs Rating Build Status

Design and query Apache Cassandra database with help of generated templates, autocomplete and inline code decorations. Supports Apache Cassandra versions 2.* and 3.*

Quick start

Open workspace (workspace path is needed for configuration to generate), activate extension by running command from palette Cassandra Workbench: Generate configuration. This will generate .cassandraWorkbench.jsonc configuration file.

Switch to Cassandra worbench panel by clicking activity bar icon. Edit .cassandraWorkbench.jsonc to suit your needs. (configuration)

Editor UI

Limitations

Multiple SELECT statements per script are not allowed. You will be notified by message:

Unable to execute multiple SELECT statements

Mixing SELECT statements with data/structure altering statements is not allowed. You will be notified by message:

Unable to execute SELECT statement along with data or structure altering statements

Key bindings

Binding
CTRL+ALT+F Find in script
CTRL+ALT+H Replace in script
CTRL+A Select all
CTRL+ENTER Execute script

Configuration

.cassandraWorkbench.jsonc file contains array of cluster connection items.

Authentication modes, currently supported (more info):

  • AllowAllAuthenticator
  • PasswordAuthenticator

When using PasswordAuthenticator, user, used to connect, must have SELECT permissions to access:

  • Cassandra 3.*
    • system_schema keyspace
  • Cassandra 2.*
    • system.schema_aggregates
    • system.schema_columnfamilies
    • system.schema_columns
    • system.schema_functions
    • system.schema_keyspaces
    • system.schema_triggers
    • system.schema_usertypes

Default configuration (generated by Cassandra Workbench: Generate configuration):

// name must be unique!
[
    // AllowAllAuthenticator
    {
        "name": "Cluster AllowAllAuthenticator",
        "contactPoints": ["127.0.0.1"]
    },
    //PasswordAuthenticator
    {
        "name": "Cluster PasswordAuthenticator",
        "contactPoints": ["127.0.0.1"],
        "authProvider": {
            "class": "PasswordAuthenticator",
            "username": "yourUsername",
            "password": "yourPassword"
        }
    }
]

Add/remove and reconfigure cluster items as needed.

Workspace configuration

cassandraWorkbench.excludeKeyspaces: string[] - default []

  • list of regexp pattern to exclude when listing keyspaces in panel

To exclude system keyspaces use:

    "cassandraWorkbench.excludeKeyspaces": [
            "^system$",
            "^system_auth$",
            "^system_distributed$",
            "^system_traces$",
            "^system_schema$"
        ]

cassandraWorkbench.useWorkspace : number - default 0

  • index of workspace where to look for configuration file .cassandraWorkbench.jsonc. For multi-root only.

vscode-cassandra's People

Contributors

kashif-khan avatar kdcro101 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

vscode-cassandra's Issues

Cassandra keyspace dropdown does not list values

I have the following Cassandra workbench configuration. All the details are correct but the cql workbench does not work. The select keyspace dropdown never shows any values. Also, I am unable to execute queries via cql command use mykeyspacename

[
    {
        "name": "localhost",
        "contactPoints": ["127.0.0.1"],
        "authProvider": {
            "class": "PasswordAuthenticator",
            "username": "myusername",
            "password": "mypassword"
        }
    }
]

User defined types shows as [object Object] in result panel

Describe the bug
When you perform a select with a user defined type (https://docs.datastax.com/en/cql/3.3/cql/cql_reference/cqlCreateType.html) the results are not in human readable format, but instead show up as [object Object]

To Reproduce
Steps to reproduce the behavior:

  1. Create a table with a user defined type (ex: CREATE TYPE space.container (weight text, height text );)
  2. Insert some data in the table with the user defined type (ex: {weight: "100", height: "100"})
  3. Perform a select with Cassandra Workbench
  4. In the result panel in the container column instead of seeing something like {weight: "100", height: "100"} you see [object Object]

Expected behavior
You should see in the result table the type as {weight: "100", height: "100"} so that you are able to read it.

System info (please complete the following information):

  • OS: ubuntu 18.04
  • Cassandra version 3.0.13
  • vscode version 1.30.2

Additional context
If you select the key of the object then it will work. For example: SELECT container FROM ... results in [object Object] but SELECT container.weight FROM ... results in 100

Escape reserved words

Hi,
I'm using Cassandra Workbench to run my code against cassandra and it is just great to use it.
At some point i need to run a command with a reserved word for a column.
Could be possible to escape this keywords to be able to execute the code?
When i try to run this code it's not executed in cassandra even when it works in cqlsh.
´´´
CREATE TABLE keyspace.table(
uniqueid text,
timestamp timestamp,
PRIMARY KEY (uniqueid , timestamp)
) WITH CLUSTERING ORDER BY (timestamp ASC);
´´´

Thanks in advance

Cursor position shifts 1 letter to the left after the intellisense loads up the where keyword

Describe the bug
Cursor position goes haywire when typing the query after the where condition is chosen from the intellisense. PFA

To Reproduce
Steps to reproduce the behavior:

  1. Open a new CQL editor.
  2. Choose the appropriate cluster and keyspace.
  3. Write a select query with where a where condition.
  4. When you type the value for the where condition the cursor position shifts 1 letter to the left. See the error in the gif.

Expected behavior
The cursor should maintain its visual and actual position in the editor.

Screenshots
cassandra-workbench-bug-1

System info (please complete the following information):

  • OS: Microsoft Windows 10 Enterprise 64 bit [Version 10.0.16299.611]
  • Cassandra version: 2.2.13
  • vscode version: 1.28.2 (user setup)
    • Commit: 7f3ce96ff4729c91352ae6def877e59c561f4850
    • Date: 2018-10-17T00:23:51.859Z
    • Electron: 2.0.9
    • Chrome: 61.0.3163.100
    • Node.js: 8.9.3
    • V8: 6.1.534.41
    • Architecture: x64

Insert doesn't seem to have an effect

Describe the bug
When executing an INSERT statement, a popup with execution time is presented but no insert is made. There is zero effect and no error information.

To Reproduce
Steps to reproduce the behavior:

  1. Set up a sample cassandra db.
  2. Try to insert data.

Expected behavior
Data inserted.

System info (please complete the following information):

  • OS: Ubuntu 19.04 and windows 10
  • Cassandra version: 3.11.3
  • vscode version: 1.38.0

Custom indexes and like clause

Hi,

Firstly, great plugin--much nicer to work with than cqlsh!

I noticed that creating a custom index didn't work from vscode cassandra workbench, but it does indeed work from cqlsh.

Cassandra workbench silently fails if you execute the following script, saying "4 Succeeded":

DROP KEYSPACE IF EXISTS mydata;
CREATE KEYSPACE mydata
	WITH REPLICATION = {
		'class': 'SimpleStrategy',
		'replication_factor': 1
	}
	AND DURABLE_WRITES = true;

use mydata;

CREATE TABLE orgs(cluster int, orgid int, name text, PRIMARY KEY(cluster, orgid));

-- ********* this index can only be created via `sqlsh` command line ***********
CREATE CUSTOM INDEX orgs_name_idx ON orgs(name) USING 'org.apache.cassandra.index.sasi.SASIIndex' WITH OPTIONS = {'analyzer_class': 'org.apache.cassandra.index.sasi.analyzer.StandardAnalyzer', 'case_sensitive': 'false'};

INSERT INTO orgs(cluster, orgid, name) VALUES(0, 1218, 'some org');
INSERT INTO orgs(cluster, orgid, name) VALUES(0, 1218, 'some other org');

image

I also noticed that the syntax highlighting thinks the like keyword is an error, but the query executes as expected and uses my custom index to fulfill the like clause.

image

System info:

  • OS: [e.g. iOS]: win10
  • Cassandra version: [cqlsh 5.0.1 | Cassandra 3.11.4 | CQL spec 3.4.4 | Native protocol v4]
  • vscode version: 1.32.3

Not working on Visual Studio Code 1.67.2

I can connect to the Cassandra server and see the list of dbs and tables in the sidebar.

If I select a table and right click and then "SELECT ALL", nothing happens while I'm expecting a CQL window to open in VS Code.

This is my VS Code version and OS:
Version: 1.67.2 (Universal)
Commit: c3511e6c69bb39013c4a4b7b9566ec1ca73fc4d5
Date: 2022-05-17T18:20:57.384Z (2 wks ago)
Electron: 17.4.1
Chromium: 98.0.4758.141
Node.js: 16.13.0
V8: 9.8.177.13-electron.0
OS: Darwin arm64 21.4.

Undefined Column if names are not lower-case

Describe the bug
Cassandra uses lower-case as default. If non-lower-case names should be preserved they need to be quoted.

To Reproduce
Steps to reproduce the behavior:

  1. Create a table with e.g. column name "userId"
  2. Select table via cassandra-workbench
    3 Message "undefined column name userId" appears as workbench selects without quotes around column-name

Expected behavior
Select should work also for non-lower-case names, so selects from workbench should be quoted.

System info (please complete the following information):

  • OS: Ubuntu 18.04
  • Cassandra version: 3.11.3
  • vscode version: 1.29.1

Unable to execute multiple SELECT statements

Describe the bug
Open a new CQL editor. Type two select queries. Select a single statement from the editor and execute. The error says it cannot execute multiple SELECT statements.

To Reproduce
Steps to reproduce the behavior:

  1. Open a new CQL editor.
  2. Type two select queries.
  3. Select a single statement from the editor and execute.
  4. The error says it cannot execute multiple statements.

Expected behavior
The editor should allow you to run the selected query from the editor.

Screenshots
cassandra-workbench-bug-2

System info (please complete the following information):

  • OS: Microsoft Windows 10 Enterprise 64 bit [Version 10.0.16299.611]
  • Cassandra version: 2.2.13
  • vscode version: 1.28.2 (user setup)
    • Commit: 7f3ce96ff4729c91352ae6def877e59c561f4850
    • Date: 2018-10-17T00:23:51.859Z
    • Electron: 2.0.9
    • Chrome: 61.0.3163.100
    • Node.js: 8.9.3
    • V8: 6.1.534.41
    • Architecture: x64

Execute selection

Describe the solution you'd like
Able to select and execute, currently it seems only execute whole file.

Error retrieving cluster structure when the cluster dropdown selection was changed

Describe the bug
Changing the cluster dropdown value in the CQL editor does not load keyspace dropdown.

To Reproduce
Steps to reproduce the behavior:

  1. Open a CQL editor.
  2. Select a cluster from the dropdown and then select a keyspace in its dropdown control.
  3. Then change the cluster dropdown and observe the keyspace dropdown showing the error Error retrieving cluster structure.

Expected behavior
Whenever a cluster dropdown value is changed then its appropriate keyspace dropdown should be populated if the cluster is able to connect to it.

Screenshots
cassandra-workbench-bug-3

System info (please complete the following information):

  • OS: Microsoft Windows 10 Enterprise 64 bit [Version 10.0.16299.611]
  • Cassandra version: 2.2.13
  • vscode version: 1.28.2 (user setup)
    • Commit: 7f3ce96ff4729c91352ae6def877e59c561f4850
    • Date: 2018-10-17T00:23:51.859Z
    • Electron: 2.0.9
    • Chrome: 61.0.3163.100
    • Node.js: 8.9.3
    • V8: 6.1.534.41
    • Architecture: x64

request-timeout

Great extension!

Is there any scope to get a request-timeout parameter added as either a cluster configuration or per query setting? This would be useful for the occasional large query that exceeds the 10 second default. You can currently do this with cqlsh by specifying "--request-timeout seconds"

Adopt VS Code's 'asWebviewUri' API

Hi, I maintain VS Code's Webview API

Issue

Our telemetry suggests that your extension uses webviews and may be loading resources in these webviews using hardcoded vscode-resource: URIs. These URIs have some important limitations and don't work properly when VS Code is run in a browser. We are also making changes in the desktop version of VS Code that may cause these URIs to not work properly in future versions of VS Code.

While we are making our best effort to continue support existing webview extensions that use vscode-resource: URIs on desktop versions of VS Code, we will not able to fully support all uses cases.

Fix

To ensure that your extension continues to work in as many environments as possible—including on web and remotely—please:

These APIs shipped around 2 years ago so they should be available in all modern versions of VS Code. You can find additional information about the issue here: microsoft/vscode#97962

Let me know if you have any questions about this change

Not able insert UDT field values.

Describe the bug
A clear and concise description of what the bug is.
I was trying to insert in UDT field with frozen, but every time its throwing error.
To Reproduce
Steps to reproduce the behavior:

  1. Create a keyspace abc

  2. Create TYPE
    CREATE TYPE basic_info (
    birthday timestamp,
    nationality text,
    weight text,
    height text
    );

  3. Create table
    CREATE TABLE cycling.cyclist_stats (
    id uuid PRIMARY KEY,
    lastname text,
    basics FROZEN<basic_info>
    );

  4. INSERT INTO cyclist_stats (id, lastname, basics) VALUES (
    e7ae5cf3-d358-4d99-b900-85902fda9bb0,
    'FRAME',
    { birthday : '1993-06-18', nationality : 'New Zealand', weight : null, height : null }
    );

Expected behavior
It should get inserted because example is from datax.
Screenshots
NA

System info (please complete the following information):

  • OS: [e.g. iOS] Windows 10
  • Cassandra version - 4.0.0.670
  • vscode version - 1.36

Additional context
Add any other context about the problem here.

Cassandra commands not found

Hey.
I use Visual Studio Code on Mac and installed your extension according to your documentation. Unfortunately it is not usable at all, since no command can be found (see screenshot). I tried all the normal things, restarting VSC, reinstalling, ...
Is there anything I am missing? Is the extension usable on Mac at all?
screen shot 2019-02-06 at 4 10 51 pm
Best,
Britta

Connect cosmosdb

Hello guys,
Has support to connect to cassandra from cosmosDB ?

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.