singlestoredb.management.workspace.Stage.open

Stage.open(stage_path: str | PathLike[str], mode: str = 'r', encoding: str | None = None) StringIO | BytesIO

Open a Stage path for reading or writing.

Parameters:
  • stage_path (Path or str) – The stage path to read / write

  • 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:

  • StageObjectBytesReader - ‘rb’ or ‘b’ mode

  • StageObjectBytesWriter - ‘wb’ or ‘xb’ mode

  • StageObjectTextReader - ‘r’ or ‘rt’ mode

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