Create a new table with same schema as the source.

        If the named table already exists, nothing happens.

        Arguments:

            name (str): The name of the table to create.
            src (str): The name of the source table to duplicate.

        Raises:

            sql.OperationalError: If source table does not exist.

def create_table_from(self, name, src):
        """
        Create a new table with same schema as the source.

        If the named table already exists, nothing happens.

        Arguments:

            name (str): The name of the table to create.
            src (str): The name of the source table to duplicate.

        Raises:

            sql.OperationalError: If source table does not exist.
        """
        # Lookup the command which was used to create the "src" table.
        query = self.execute("SELECT sql FROM sqlite_master WHERE "
                             "type='table' and name=?", (src,))
        try:
            cmd = query.fetchone()[0]
        except TypeError:
            raise sql.OperationalError("Cannot copy non-existent table '{0}'"
                                       .format(src))

        # Modify the original command to replace the old table name
        # with the new one.
        new_cmd = re.sub("(CREATE TABLE) \w+", "\\1 " + name, cmd,
                         re.IGNORECASE)

        # Execute this new command.
        self.execute(new_cmd)