python/scannerpy/database.py
def new_table(self, name, columns, rows, fn=None, force=False):
        """
        Creates a new table from a list of rows.

        Args:
            name: String name of the table to create
            columns: List of names of table columns
            rows: List of rows with each row a list of elements corresponding
                  to the specified columns. Elements must be strings of
                  serialized representations of the data.

        Kwargs:
            fn: TODO(wcrichto)
            force: TODO(apoms)

        Returns:
            The new table object.
        """

        if self.has_table(name):
            if force:
                self.delete_table(name)
            else:
                raise ScannerException('Attempted to create table with existing '
                                       'name {}'.format(name))
        if fn is not None:
            rows = [fn(row, self.protobufs) for row in rows]
        cols = copy.copy(columns)
        cols.insert(0, "index")
        for i, row in enumerate(rows):
            row.insert(0, struct.pack('=Q', i))
        self._bindings.new_table(self._db, name.encode('ascii'),
                                 [s.encode('ascii') for s in cols],
                                 rows)
        self._cached_db_metadata = None
        return self.table(name)

        Creates a new table from a list of rows.

        Args:
            name: String name of the table to create
            columns: List of names of table columns
            rows: List of rows with each row a list of elements corresponding
                  to the specified columns. Elements must be strings of
                  serialized representations of the data.

        Kwargs:
            fn: TODO(wcrichto)
            force: TODO(apoms)

        Returns:
            The new table object.
        
Creates a new table from a list of rows.
Creates a new table from a list of rows .
def new_table(self, name, columns, rows, fn=None, force=False):
        if self.has_table(name):
            if force:
                self.delete_table(name)
            else:
                raise ScannerException('Attempted to create table with existing '
                                       'name {}'.format(name))
        if fn is not None:
            rows = [fn(row, self.protobufs) for row in rows]
        cols = copy.copy(columns)
        cols.insert(0, "index")
        for i, row in enumerate(rows):
            row.insert(0, struct.pack('=Q', i))
        self._bindings.new_table(self._db, name.encode('ascii'),
                                 [s.encode('ascii') for s in cols],
                                 rows)
        self._cached_db_metadata = None
        return self.table(name)
def new_table ( self , name , columns , rows , fn = None , force = False ) : if self . has_table ( name ) : if force : self . delete_table ( name ) else : raise ScannerException ( 'Attempted to create table with existing ' 'name {}' . format ( name ) ) if fn is not None : rows = [ fn ( row , self . protobufs ) for row in rows ] cols = copy . copy ( columns ) cols . insert ( 0 , "index" ) for i , row in enumerate ( rows ) : row . insert ( 0 , struct . pack ( '=Q' , i ) ) self . _bindings . new_table ( self . _db , name . encode ( 'ascii' ) , [ s . encode ( 'ascii' ) for s in cols ] , rows ) self . _cached_db_metadata = None return self . table ( name )
Creates a new table from a list of rows.
Creates a new table from a list of rows .
"""
        Creates a new table from a list of rows.

        Args:
            name: String name of the table to create
            columns: List of names of table columns
            rows: List of rows with each row a list of elements corresponding
                  to the specified columns. Elements must be strings of
                  serialized representations of the data.

        Kwargs:
            fn: TODO(wcrichto)
            force: TODO(apoms)

        Returns:
            The new table object.
        """
The new table object.
The new table object .
self
name
String name of the table to create
String name of the table to create
columns
List of names of table columns
List of names of table columns
rows
List of rows with each row a list of elements corresponding
to the specified columns. Elements must be strings of
serialized representations of the data.
List of rows with each row a list of elements corresponding to the specified columns . Elements must be strings of serialized representations of the data .
fn
force