python/scannerpy/database.py
def new_collection(self, collection_name, tables, force=False, job_id=None):
        """
        Creates a new Collection from a list of tables.

        Args:
            collection_name: String name of the collection to create.
            table_names: List of table name strings to put in the collection.

        Kwargs:
            force: TODO(wcrichto)
            job_id: TODO(wcrichto)

        Returns:
            The new Collection object.
        """

        if collection_name in self._collections.names:
            if force:
                self.delete_collection(collection_name)
            else:
                raise ScannerException(
                    'Collection with name {} already exists'
                    .format(collection_name))

        table_names = []
        for table in tables:
            table_names.append(table.name())

        last_id = (
            self._collections.ids[-1] if len(self._collections.ids) > 0 else -1)
        new_id = last_id + 1
        self._collections.ids.append(new_id)
        self._collections.names.append(collection_name)
        self._update_collections()
        collection = self.protobufs.CollectionDescriptor()
        collection.tables.extend(table_names)
        collection.job_id = -1 if job_id is None else job_id
        self._save_descriptor(collection, 'pydb/collection_{}.bin'.format(new_id))

        return self.collection(collection_name)

        Creates a new Collection from a list of tables.

        Args:
            collection_name: String name of the collection to create.
            table_names: List of table name strings to put in the collection.

        Kwargs:
            force: TODO(wcrichto)
            job_id: TODO(wcrichto)

        Returns:
            The new Collection object.
        
Creates a new Collection from a list of tables.
Creates a new Collection from a list of tables .
def new_collection(self, collection_name, tables, force=False, job_id=None):
        if collection_name in self._collections.names:
            if force:
                self.delete_collection(collection_name)
            else:
                raise ScannerException(
                    'Collection with name {} already exists'
                    .format(collection_name))
        table_names = []
        for table in tables:
            table_names.append(table.name())
        last_id = (
            self._collections.ids[-1] if len(self._collections.ids) > 0 else -1)
        new_id = last_id + 1
        self._collections.ids.append(new_id)
        self._collections.names.append(collection_name)
        self._update_collections()
        collection = self.protobufs.CollectionDescriptor()
        collection.tables.extend(table_names)
        collection.job_id = -1 if job_id is None else job_id
        self._save_descriptor(collection, 'pydb/collection_{}.bin'.format(new_id))
        return self.collection(collection_name)
def new_collection ( self , collection_name , tables , force = False , job_id = None ) : if collection_name in self . _collections . names : if force : self . delete_collection ( collection_name ) else : raise ScannerException ( 'Collection with name {} already exists' . format ( collection_name ) ) table_names = [ ] for table in tables : table_names . append ( table . name ( ) ) last_id = ( self . _collections . ids [ - 1 ] if len ( self . _collections . ids ) > 0 else - 1 ) new_id = last_id + 1 self . _collections . ids . append ( new_id ) self . _collections . names . append ( collection_name ) self . _update_collections ( ) collection = self . protobufs . CollectionDescriptor ( ) collection . tables . extend ( table_names ) collection . job_id = - 1 if job_id is None else job_id self . _save_descriptor ( collection , 'pydb/collection_{}.bin' . format ( new_id ) ) return self . collection ( collection_name )
Creates a new Collection from a list of tables.
Creates a new Collection from a list of tables .
"""
        Creates a new Collection from a list of tables.

        Args:
            collection_name: String name of the collection to create.
            table_names: List of table name strings to put in the collection.

        Kwargs:
            force: TODO(wcrichto)
            job_id: TODO(wcrichto)

        Returns:
            The new Collection object.
        """
The new Collection object.
The new Collection object .
self
collection_name
String name of the collection to create.
String name of the collection to create .
tables
force
job_id
table_names
List of table name strings to put in the collection.
List of table name strings to put in the collection .