# dbprocessing

# dbprocessing.DBfile.DBfile

class dbprocessing.DBfile.DBfile(diskfile, dbu, makeDiskFile=False)

  Maps a physical file on disk to database file entry.

  DBfile class is an extension of Diskfile that takes a physical file on disk and maps it to the database file entry, this is not mapped to the file table in the DB but instead a bridge between the two.

  __init__(diskfile, dbu, makeDiskFile=False)

    Setup a DBfile class.

    Todo

    Do we need this keyword or the functionality?

    Parameters
      diskfile `str` or `Diskfile`

        A file name or diskfile instance to create a DBfile from

      dbu `DButils`, optional

        Current database connection. If not specified, creates a new connection.

      makeDiskFile `bool`, default False

        If true, `diskfile` is a filename and needs a `Diskfile` made.

  Methods

  `addFileToDB`() | Wrapper around `addFile()` to take params dict to keywords
  `getDirectory`() | Query the DB and get the directory that the file should exist in
  `move`() | Move the DBfile from its current location to where it belongs

  addFileToDB()

    Wrapper around `addFile()` to take params dict to keywords

    Returns
      `int`

        `file_id` of the newly added file

  getDirectory()

    Query the DB and get the directory that the file should exist in

    Returns
      `str`

        The full path for the DBfile

  move()

    Move the DBfile from its current location to where it belongs

    If the file is a symbolic link it is assumed already in the target directory and not moved, the link is just removed

    Returns
      :class:`tuple` of class:str

        from and to arguments to move with full path info

Release: 0.1.0 Doc generation date: Feb 10, 2022