Unable to add cassandra connection - cassandra

I am trying to add an connection to my cassandra database.
As shown in the examples I added this definition:
#Store(type='cassandra', column.family='StockTable',keyspace='AnalyticsFamily',cassandra.host='localhost')
#IndexBy('volume')
#PrimaryKey('symbol')
define table StockTable (symbol string, price float, volume long);
In the editor I get an red cross as shown in the image below.
Am I missing the cassandra driver on the worker? If yes, how can I add it to the docker image? Or what am I doing wrong?

You have to add the osgi compatible cassandra connectors to {SP_HOME}/lib folder.
Please see https://docs.wso2.com/display/SP4xx/Configuring+Datasources for more details

Related

Push in existing local table failure (windows): InvalidRegionNumberException then IllegalArgumentException

I want to push data into an already existing table, single column family, no records.
I am using shc-core:1.1.1-2.1-s_2.11 on a windows machine. I have hbase 1.2.6 installed and use scala 2.11.8.
When I try to push data I got first the following error: org.apache.spark.sql.execution.datasources.hbase.InvalidRegionNumberException: Number of regions specified for new table must be greater than 3.
After following the advice of this link https://github.com/hortonworks-spark/shc/issues/249#issue-318285217, I added: HBaseTableCatalog.newTable -> "5" to my options.
It still failed but with: java.lang.IllegalArgumentException: Can not create a Path from a null string.
Following this link: https://github.com/hortonworks-spark/shc/issues/151#issuecomment-313800739, I added to my catalog: , "tableCoder":"PrimitiveType".
Still facing the same error.
I saw people are expecting some clarification about this issue (https://github.com/hortonworks-spark/shc/issues/249#issuecomment-463528032).
It is known issue and apparently it seems fixed (https://github.com/hortonworks-spark/shc/issues/155#issuecomment-315236736).
I do not know what to do next.
Is there a solution about this?

Postgis - migration from 1.5 to 2.3 - workaround

Fellows,
I already had a really hard time trying to make a migration from a postgis 1.5 to 2.3. Actually I had many attempts to do that with all version of postgis: 2.0, 2.1, 2.2 and now 2.3.
As I have spent a few weeks with that, and as I am ready to drop that I keep using my old version of postgresql and postgis, I hope my question finds a echo somewhere...
I only want to migrate one table field, a geometry field. So before trying to do that, I would like to hear if any of you have experience with that:
The idea is to select the field from the old postgis (postgresql 9.2, postgis 1.5), and update the table to the new postgis (postgresql 9.6, postgis 2.3).
Anyone can say anything about it?
EDIT---
I have just tryed to import the table I needed, but I got an error:
violation of constraint "enforce_srid_the_geom".
:(
Thanks a lot.
If you need to migrate just a single table with a geometry column and you are getting troubles with the procedure described here http://www.postgis.org/docs/postgis_installation.html#hard_upgrade
I'd suggest a workaround: create a text field in the old db, e.g. wkt_geom, then execute
update tablename set wkt_geom = st_astext(the_geom)
Now drop the geometry column, export the old db and import into the new one. Then, create the geometry column and
update tablename set the_geom = st_geomfromtext(wkt_geom, SRID_HERE)

Load example GraphSON file in Gremlin with Cassandra

I'm trying to load the example Graph of the Gods file that is distributed with Titan with the loadGraphSON function. I have executed the following steps and are working with Titan 0.5.4 with Hadoop 2.
Downloaded and unpacked a fresh Titan 0.5.4 with Hadoop 2.
Started Titan, Rexster, Cassandra, ElasticSearch with the command bin/titan.sh -c cassandra-es start
Run Gremlin with: bin/gremlin.sh
Open a new TitanFactory instance with the required settings: g = TitanFactory.open('conf/titan-cassandra-es.properties')
Then I tried to load the Graph of the Gods from the examples-directory with g.loadGraphSON("examples/graph-of-the-gods")
I do not get an error, but trying to show all vertices with g.V returns nothing. Am I executing the rights steps here, or am I doing something wrong?
Note that this question was answered on the Aurelius Graphs Mailing List:
https://groups.google.com/d/msg/aureliusgraphs/FiCvX891r6g/BkmWj3xc3ikJ
Basically:
1) the filename should be examples/graph-of-the-gods.json
2) you can also use GraphOfTheGodsFactory.load(g) which will also create indexes and type definitions
I'd say the second point above would be the preferred manner in which to load Graph of the Gods.
If you're not setting up a Titan Hadoop job, you could try using the Blueprints GraphSON reader to load graph data. See https://github.com/tinkerpop/blueprints/wiki/GraphSON-Reader-and-Writer-Library
In a Gremlin shell it looks a bit like this:
inStream = new FileInputStream("../examples/graph-of-the-gods.json")
GraphSONReader.inputGraph(g, inStream)

who has a whole cassandra jdbc example which can run in eclipse?

the example may include:
create keyspace and columnfamily
insert data
select/get data and show in Console
because I found this http://cassandra.apache.org/doc/cql/CQL.html is hard to me
thank you for attention , I got it http://niranjandubey.blogspot.com/2012/11/cassandra-jdbc-to-perform-crud.html.
But I also need a FILE-read-write example of cassandra (may be using datastax?)

int object has no attribute replace when trying to run a CQL command in cassandra

I have a counter column family in cassandra. When i try to view the data from CQL i get an error even though there is data in the column family.
SELECT * from userstats;
Generates the following error:
'int' object has no attribute 'replace'
I can confirm that the data is in the column family and is working properly since I can view the data with the Datastax Opscenter data explorer.
It sounds like you're using an older version of cqlsh. Upgrading it (just copying the bin/cqlsh file from the Cassandra 1.1 branch head, along with everything under the pylib directory, into place) ought to solve this.
If it doesn't, running cqlsh with --debug would help a lot in diagnosing the problem.

Resources