class_docstr: Interface used to write a streaming :class:`DataFrame <pyspark.sql.DataFrame>` to external
  storage systems (e.g. file systems, key-value stores, etc).
  Use :attr:`DataFrame.writeStream <pyspark.sql.DataFrame.writeStream>`
  to access this.
  
  .. versionadded:: 2.0.0
  
  .. versionchanged:: 3.5.0
      Supports Spark Connect.
  
  Notes
  -----
  This API is evolving.
  
  Examples
  --------
  The example below uses Rate source that generates rows continuously.
  After that, we operate a modulo by 3, and then writes the stream out to the console.
  The streaming query stops in 3 seconds.
  
  >>> import time
  >>> df = spark.readStream.format("rate").load()
  >>> df = df.selectExpr("value % 3 as v")
  >>> q = df.writeStream.format("console").start()
  >>> time.sleep(3)
  >>> q.stop()
class_docstr_tok: ["Interface","used","to","write","a","streaming",":","class",":","`","DataFrame","<","pyspark.sql.DataFrame",">","`","to","external","storage","systems","(","e.g",".","file","systems",",","key-value","stores",",","etc",")",".","Use",":","attr",":","`","DataFrame.writeStream","<","pyspark.sql.DataFrame.writeStream",">","`","to","access","this",".","..","versionadded",":",":","2.0.0","..","versionchanged",":",":","3.5.0","Supports","Spark","Connect",".","Notes","--","--","-","This","API","is","evolving",".","Examples","--","--","--","--","The","example","below","uses","Rate","source","that","generates","rows","continuously",".","After","that",",","we","operate","a","modulo","by","3",",","and","then","writes","the","stream","out","to","the","console",".","The","streaming","query","stops","in","3","seconds",".",">",">",">","import","time",">",">",">","df","=","spark.readStream.format","(","``","rate","''",")",".load","(",")",">",">",">","df","=","df.selectExpr","(","``","value","%","3","as","v","''",")",">",">",">","q","=","df.writeStream.format","(","``","console","''",")",".start","(",")",">",">",">","time.sleep","(","3",")",">",">",">","q.stop","(",")"]
docstr: Set the trigger for the stream query. If this is not set it will run the query as fast
  as possible, which is equivalent to setting the trigger to ``processingTime='0 seconds'``.
  
  .. versionadded:: 2.0.0
  
  .. versionchanged:: 3.5.0
      Supports Spark Connect.
  
  Parameters
  ----------
  processingTime : str, optional
      a processing time interval as a string, e.g. '5 seconds', '1 minute'.
      Set a trigger that runs a microbatch query periodically based on the
      processing time. Only one trigger can be set.
  once : bool, optional
      if set to True, set a trigger that processes only one batch of data in a
      streaming query then terminates the query. Only one trigger can be set.
  continuous : str, optional
      a time interval as a string, e.g. '5 seconds', '1 minute'.
      Set a trigger that runs a continuous query with a given checkpoint
      interval. Only one trigger can be set.
  availableNow : bool, optional
      if set to True, set a trigger that processes all available data in multiple
      batches then terminates the query. Only one trigger can be set.
  
  Notes
  -----
  This API is evolving.
  
  Examples
  --------
  >>> df = spark.readStream.format("rate").load()
  
  Trigger the query for execution every 5 seconds
  
  >>> df.writeStream.trigger(processingTime='5 seconds')
  <...streaming.readwriter.DataStreamWriter object ...>
  
  Trigger the query for execution every 5 seconds
  
  >>> df.writeStream.trigger(continuous='5 seconds')
  <...streaming.readwriter.DataStreamWriter object ...>
  
  Trigger the query for reading all available data with multiple batches
  
  >>> df.writeStream.trigger(availableNow=True)
  <...streaming.readwriter.DataStreamWriter object ...>
docstr_tok: ["Set","the","trigger","for","the","stream","query",".","If","this","is","not","set","it","will","run","the","query","as","fast","as","possible",",","which","is","equivalent","to","setting","the","trigger","to","``","processingTime=","'","0","seconds","'","``",".","..","versionadded",":",":","2.0.0","..","versionchanged",":",":","3.5.0","Supports","Spark","Connect",".","Parameters","--","--","--","--","--","processingTime",":","str",",","optional","a","processing","time","interval","as","a","string",",","e.g",".","'","5","seconds","'",",","'","1","minute","'",".","Set","a","trigger","that","runs","a","microbatch","query","periodically","based","on","the","processing","time",".","Only","one","trigger","can","be","set",".","once",":","bool",",","optional","if","set","to","True",",","set","a","trigger","that","processes","only","one","batch","of","data","in","a","streaming","query","then","terminates","the","query",".","Only","one","trigger","can","be","set",".","continuous",":","str",",","optional","a","time","interval","as","a","string",",","e.g",".","'","5","seconds","'",",","'","1","minute","'",".","Set","a","trigger","that","runs","a","continuous","query","with","a","given","checkpoint","interval",".","Only","one","trigger","can","be","set",".","availableNow",":","bool",",","optional","if","set","to","True",",","set","a","trigger","that","processes","all","available","data","in","multiple","batches","then","terminates","the","query",".","Only","one","trigger","can","be","set",".","Notes","--","--","-","This","API","is","evolving",".","Examples","--","--","--","--",">",">",">","df","=","spark.readStream.format","(","``","rate","''",")",".load","(",")","Trigger","the","query","for","execution","every","5","seconds",">",">",">","df.writeStream.trigger","(","processingTime=","'","5","seconds","'",")","<","...","streaming.readwriter.DataStreamWriter","object","...",">","Trigger","the","query","for","execution","every","5","seconds",">",">",">","df.writeStream.trigger","(","continuous=","'","5","seconds","'",")","<","...","streaming.readwriter.DataStreamWriter","object","...",">","Trigger","the","query","for","reading","all","available","data","with","multiple","batches",">",">",">","df.writeStream.trigger","(","availableNow=True",")","<","...","streaming.readwriter.DataStreamWriter","object","...",">"]
code: def trigger(
      self,
      *,
      processingTime: Optional[str] = None,
      once: Optional[bool] = None,
      continuous: Optional[str] = None,
      availableNow: Optional[bool] = None,
  ) -> "DataStreamWriter":
      """Set the trigger for the stream query. If this is not set it will run the query as fast
      as possible, which is equivalent to setting the trigger to ``processingTime='0 seconds'``.
  
      .. versionadded:: 2.0.0
  
      .. versionchanged:: 3.5.0
          Supports Spark Connect.
  
      Parameters
      ----------
      processingTime : str, optional
          a processing time interval as a string, e.g. '5 seconds', '1 minute'.
          Set a trigger that runs a microbatch query periodically based on the
          processing time. Only one trigger can be set.
      once : bool, optional
          if set to True, set a trigger that processes only one batch of data in a
          streaming query then terminates the query. Only one trigger can be set.
      continuous : str, optional
          a time interval as a string, e.g. '5 seconds', '1 minute'.
          Set a trigger that runs a continuous query with a given checkpoint
          interval. Only one trigger can be set.
      availableNow : bool, optional
          if set to True, set a trigger that processes all available data in multiple
          batches then terminates the query. Only one trigger can be set.
  
      Notes
      -----
      This API is evolving.
  
      Examples
      --------
      >>> df = spark.readStream.format("rate").load()
  
      Trigger the query for execution every 5 seconds
  
      >>> df.writeStream.trigger(processingTime='5 seconds')
      <...streaming.readwriter.DataStreamWriter object ...>
  
      Trigger the query for execution every 5 seconds
  
      >>> df.writeStream.trigger(continuous='5 seconds')
      <...streaming.readwriter.DataStreamWriter object ...>
  
      Trigger the query for reading all available data with multiple batches
  
      >>> df.writeStream.trigger(availableNow=True)
      <...streaming.readwriter.DataStreamWriter object ...>
      """
      params = [processingTime, once, continuous, availableNow]
  
      if params.count(None) == 4:
          raise PySparkValueError(
              error_class="ONLY_ALLOW_SINGLE_TRIGGER",
              message_parameters={},
          )
      elif params.count(None) < 3:
          raise PySparkValueError(
              error_class="ONLY_ALLOW_SINGLE_TRIGGER",
              message_parameters={},
          )
  
      jTrigger = None
      assert self._spark._sc._jvm is not None
      if processingTime is not None:
          if (
              type(processingTime) != str
              or len(processingTime.strip()) == 0
          ):
              raise PySparkValueError(
                  error_class="VALUE_NOT_NON_EMPTY_STR",
                  message_parameters={
                      "arg_name": "processingTime",
                      "arg_value": str(processingTime),
                  },
              )
          interval = processingTime.strip()
          jTrigger = self._spark._sc._jvm.org.apache.spark.sql.streaming.Trigger.ProcessingTime(
              interval
          )
  
      elif once is not None:
          if once is not True:
              raise PySparkValueError(
                  error_class="VALUE_NOT_TRUE",
                  message_parameters={
                      "arg_name": "once",
                      "arg_value": str(once),
                  },
              )
  
          jTrigger = (
              self._spark._sc._jvm.org.apache.spark.sql.streaming.Trigger.Once()
          )
  
      elif continuous is not None:
          if type(continuous) != str or len(continuous.strip()) == 0:
              raise PySparkValueError(
                  error_class="VALUE_NOT_NON_EMPTY_STR",
                  message_parameters={
                      "arg_name": "continuous",
                      "arg_value": str(continuous),
                  },
              )
          interval = continuous.strip()
          jTrigger = self._spark._sc._jvm.org.apache.spark.sql.streaming.Trigger.Continuous(
              interval
          )
      else:
          if availableNow is not True:
              raise PySparkValueError(
                  error_class="VALUE_NOT_TRUE",
                  message_parameters={
                      "arg_name": "availableNow",
                      "arg_value": str(availableNow),
                  },
              )
          jTrigger = (
              self._spark._sc._jvm.org.apache.spark.sql.streaming.Trigger.AvailableNow()
          )
  
      self._jwrite = self._jwrite.trigger(jTrigger)
      return self
  
imports: import sys
  from collections.abc import Iterator
  from typing import cast, overload, Any, Callable, List, Optional, TYPE_CHECKING, Union
  from py4j.java_gateway import java_import, JavaObject
  from pyspark.sql.column import _to_seq
  from pyspark.sql.readwriter import OptionUtils, to_str
  from pyspark.sql.streaming.query import StreamingQuery
  from pyspark.sql.types import Row, StructType
  from pyspark.sql.utils import ForeachBatchFunction
  from pyspark.errors import PySparkTypeError, PySparkValueError, PySparkAttributeError, PySparkRuntimeError
label_desc: Use image node_id 15 for calling the DataStreamWriter obj's underlying member method code with example usage: obj.trigger() and returns: self