dbprocessing.DBfile.DBfile

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

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)[source]

Setup a DBfile class.

Todo

Do we need this keyword or the functionality?

Parameters
diskfilestr or Diskfile

A file name or diskfile instance to create a DBfile from

dbuDButils, optional

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

makeDiskFilebool, 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()[source]

Wrapper around addFile() to take params dict to keywords

Returns
int

file_id of the newly added file

getDirectory()[source]

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

Returns
str

The full path for the DBfile

move()[source]

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` ofclass:str

from and to arguments to move with full path info


Release: 0.1.0 Doc generation date: Feb 10, 2022