I'm trying to store some tweets in Cassandra Database using Python and DataStax driver ( Python -> Cassandra ).
Everything works well, but there's something that I can't understand. How to insert a row without null value ?
As example,
CREATE TABLE tweets (
id_tweet text PRIMARY KEY,
texttweet text,
hashtag text,
url text,
)
If I want to insert a row without url value, it's working but in Cassandra I'll see "null" in url column.
I check this doc :
http://datastax.github.io/python-driver/getting_started.html#passing-parameters-to-cql-queries
So I tried 2 differents ways :
First one, I create the String as a full String, and execute it.
requete = "insert into Tweets(id_tweet,texttweet,hashtag,url) values ('%s','%s','%s','%s')"%(id_tweet,texttweet,hashtag,url)
session.execute(requete)
Or
I send parameters in the execute function.
requete2 = "insert into Tweets(id_tweet,texttweet,hashtag,url) values ('%s','%s','%s','%s')"
session.execute(requete2,(id_tweet,id_texttweet,hashtag,url))
Problem is, the 2differents ways give me null value if i get no URL or Hashtag in my tweet as example.
Is it possible to not see the column if it's empty in a row, like I see in lot of tutorials ?
Thanks.