Cassandra Table case sensitive table name 91/14291/2
authorrajdeep11 <rajdeep.sin@samsung.com>
Tue, 1 Apr 2025 08:26:09 +0000 (13:56 +0530)
committerRajdeep Singh <rajdeep.sin@samsung.com>
Tue, 15 Apr 2025 11:23:59 +0000 (11:23 +0000)
Description:
1) Adding quotes to the table name to save the table name as it is.

Issue-ID: AIMLFW-183
Change-Id: If2a59d27478503b69c231f51923cdcaffe3a7c34
Signed-off-by: rajdeep11 <rajdeep.sin@samsung.com>
dataextraction/sink/CassandraSink.py

index e8aab1f..564b313 100644 (file)
@@ -156,7 +156,7 @@ class CassandraSink(Sink):
         choosing _partition_key in sparkdf as partition key,
         _Id as clustering key for table
         """
-        query = "CREATE TABLE " + self.tableName + ' ( "_partition_key" text, "_Id" bigint, '
+        query = 'CREATE TABLE "' + self.tableName + '" ( "_partition_key" text, "_Id" bigint, '
         if sparkdf is not None:
             col_list = sparkdf.schema.names
             # To maintain the column name case sensitivity
@@ -172,7 +172,7 @@ class CassandraSink(Sink):
         """
         Builds simple cassandra query for deleting table
         """
-        query = "DROP TABLE IF EXISTS  " + self.tableName + " ;"
+        query = 'DROP TABLE IF EXISTS "' + self.tableName + '" ;'
         self.logger.debug("Delete table query " + query)
         return query