singlestoredb.management.workspace.StageObject.open

StageObject.open(mode: str = 'r', encoding: str | None = None) StringIO | BytesIO

Open a file path for reading or writing.

Parameters:
  • mode (str, optional) –

    The read / write mode. The following modes are supported:
    • ’r’ open for reading (default)

    • ’w’ open for writing, truncating the file first

    • ’x’ create a new file and open it for writing

    The data type can be specified by adding one of the following:
    • ’b’ binary mode

    • ’t’ text mode (default)

  • encoding (str, optional) – The string encoding to use for text

Returns:

  • FilesObjectBytesReader - ‘rb’ or ‘b’ mode

  • FilesObjectBytesWriter - ‘wb’ or ‘xb’ mode

  • FilesObjectTextReader - ‘r’ or ‘rt’ mode

  • FilesObjectTextWriter - ‘w’, ‘x’, ‘wt’ or ‘xt’ mode