latitude-dev / latitude

Developer-first embedded analytics
https://latitude.so
GNU Lesser General Public License v3.0
770 stars 33 forks source link

Can we configure Cassandra as data source? #543

Open navyademo1 opened 1 week ago

navyademo1 commented 1 week ago

Hi,

I have a query, can we connect to Cassandra data source, if not

  1. Can we expect in near future?
  2. Is there a way to implement custom connector for this?
andresgutgon commented 1 week ago

Is there a way to implement custom connector for this?

Yes, never worked with Casandra. But maybe using under the hood something like this package https://github.com/datastax/nodejs-driver and implementing the methods in BaseConnector

Any connector in connectors folder can serve as example: https://github.com/latitude-dev/latitude/tree/main/packages/connectors

We might implement ourselves I'll keep the issue open.

navyademo1 commented 1 week ago

Got it, thanks for the update.

navyademo1 commented 1 week ago

Hi @andresgutgon , I just need to add this basic logic in BaseConnector?

const cassandra = require('cassandra-driver');

const client = new cassandra.Client({ contactPoints: ['h1', 'h2'], localDataCenter: 'datacenter1', keyspace: 'ks1' });

const query = 'SELECT name, email FROM users WHERE key = ?';

client.execute(query, [ 'someone' ]) .then(result => console.log('User with email %s', result.rows[0].email));

am new to the JavaScript basically from Java background.

navyademo1 commented 1 week ago

Can you please share which will be the landing file of the latitude project when we trigger the endpoint from react app..?