src/utils/cassandra_helper.py
def retrive_dataset(self, table_name):
        """
        [summary]:This Function will retrieve data from table
        Args:
            table_name ([type]): [name of table]

        Returns:
            [type]: [Pandas DataFrame]
        """
        try:
            session = self.cluster.connect(self.keyspace)
            dataframe = pd.DataFrame(list(session.execute(f'select * from {table_name}'))).drop(columns=['column_count'])
            
            for col in dataframe.columns:
                col_name = col.split("__dt__")[0]
                col_datatype = col.split("__dt__")[1]
                dataframe.rename(columns={col: col_name}, inplace=True)
                try:
                    dataframe[col_name] = dataframe[col_name].astype(col_datatype)
                except Exception as e:
                    print(e)
            return dataframe


        except Exception as e:
            print(e)

        finally:
            if not session.is_shutdown:
                session.shutdown()
                print("cassandra session is closed")

        [summary]:This Function will retrieve data from table
        Args:
            table_name ([type]): [name of table]

        Returns:
            [type]: [Pandas DataFrame]
        
[summary]:This Function will retrieve data from table
[ summary ] : This Function will retrieve data from table
def retrive_dataset(self, table_name):
        try:
            session = self.cluster.connect(self.keyspace)
            dataframe = pd.DataFrame(list(session.execute(f'select * from {table_name}'))).drop(columns=['column_count'])
            for col in dataframe.columns:
                col_name = col.split("__dt__")[0]
                col_datatype = col.split("__dt__")[1]
                dataframe.rename(columns={col: col_name}, inplace=True)
                try:
                    dataframe[col_name] = dataframe[col_name].astype(col_datatype)
                except Exception as e:
                    print(e)
            return dataframe
        except Exception as e:
            print(e)
        finally:
            if not session.is_shutdown:
                session.shutdown()
                print("cassandra session is closed")
def retrive_dataset ( self , table_name ) : try : session = self . cluster . connect ( self . keyspace ) dataframe = pd . DataFrame ( list ( session . execute ( f'select * from {table_name}' ) ) ) . drop ( columns = [ 'column_count' ] ) for col in dataframe . columns : col_name = col . split ( "__dt__" ) [ 0 ] col_datatype = col . split ( "__dt__" ) [ 1 ] dataframe . rename ( columns = { col : col_name } , inplace = True ) try : dataframe [ col_name ] = dataframe [ col_name ] . astype ( col_datatype ) except Exception as e : print ( e ) return dataframe except Exception as e : print ( e ) finally : if not session . is_shutdown : session . shutdown ( ) print ( "cassandra session is closed" )
[summary]:This Function will retrieve data from table
[ summary ] : This Function will retrieve data from table
"""
        [summary]:This Function will retrieve data from table
        Args:
            table_name ([type]): [name of table]

        Returns:
            [type]: [Pandas DataFrame]
        """
None
[type]
self
table_name
[name of table]
[ name of table ]