Skip to content

Files

from qdl import File

File

Files store the binary content of data.

A file in QDL only represents the metadata, the binary content is not automatically added or updated. The upload method from a dataset needs to be called explicitly to add or update the binary content as well.

Parameters:

Name Type Description Default
scope_uid UID

UID of the scope in which to create the file.

required
name NonEmptyString2000

Name of the file.

required

exists classmethod

Check if the file with the given scope UID and UID exists in QDL.

Parameters:

Name Type Description Default
scope_uid UID

Scope UID of the file.

required
uid UID

UID of the file.

required

Returns:

Type Description
bool

True when the file exists, otherwise False.

Raises:

Type Description
QdlSdkException

HTTP error code with description.

file_path property writable

Field that specifies the local location of the file for uploads.

generated_by property writable

Field that specifies the generator of the file.

get_file_versions classmethod

Get a list of file versions for the file with the given scope UID and UID from QDL.

Parameters:

Name Type Description Default
scope_uid UID

Scope UID of the file.

required
uid UID

UID of the file.

required

Returns:

Type Description
List[DictStrAny]

List with each file version as a dictionary.

Raises:

Type Description
QdlSdkException

HTTP error code with description.

get_versions

Get a list of file versions for this file from QDL.

Returns:

Type Description
List[DictStrAny]

List with each file version as a dictionary.

Raises:

Type Description
QdlSdkException

HTTP error code with description.

is_dir property

Flag indicating if this file name refers to a directory.

is_mutable property writable

Flag if the file is mutable.

Notes

When a file is mutable new versions of the file can be uploaded, otherwise this is not allowed.

location property writable

URL to the storage location of the file.

md5sum property

Field that specifies the md5sum of the file.

mimetype property writable

Field that specifies the mimetype of the file.

name property

Name of the file.

Notes

This name may contain path separators.

rank property writable

Rank of the file.

scope property writable

Scope UID of the file.

storage_status property

Read-only field that specifies the storage status of the file.

tags property writable

Field that specifies the tags of the file.

uid property

UID of the file.

uuid property writable

UUID of the file.

version_id property

Version ID of the file in QDL.

Notes

The latest version of the file is defined by a None value.