[docs]def__init__(self,table:Optional[str]=None,session:Optional[Session]=None,keyspace:Optional[str]=None,query:Union[str,Statement,None]=None,page_content_mapper:Callable[[Any],str]=str,metadata_mapper:Callable[[Any],dict]=lambda_:{},*,query_parameters:Union[dict,Sequence,None]=None,query_timeout:Optional[float]=_NOT_SET,# type: ignore[assignment]query_trace:bool=False,query_custom_payload:Optional[dict]=None,query_execution_profile:Any=_NOT_SET,query_paging_state:Any=None,query_host:Optional[Host]=None,query_execute_as:Optional[str]=None,)->None:""" Document Loader for Apache Cassandra. Args: table: The table to load the data from. (do not use together with the query parameter) session: The cassandra driver session. If not provided, the cassio resolved session will be used. keyspace: The keyspace of the table. If not provided, the cassio resolved keyspace will be used. query: The query used to load the data. (do not use together with the table parameter) page_content_mapper: a function to convert a row to string page content. Defaults to the str representation of the row. metadata_mapper: a function to convert a row to document metadata. query_parameters: The query parameters used when calling session.execute . query_timeout: The query timeout used when calling session.execute . query_trace: Whether to use tracing when calling session.execute . query_custom_payload: The query custom_payload used when calling session.execute . query_execution_profile: The query execution_profile used when calling session.execute . query_host: The query host used when calling session.execute . query_execute_as: The query execute_as used when calling session.execute . """ifqueryandtable:raiseValueError("Cannot specify both query and table.")ifnotqueryandnottable:raiseValueError("Must specify query or table.")ifnotsessionor(tableandnotkeyspace):try:fromcassio.configimportcheck_resolve_keyspace,check_resolve_sessionexcept(ImportError,ModuleNotFoundError):raiseImportError("Could not import a recent cassio package.""Please install it with `pip install --upgrade cassio`.")iftable:_keyspace=keyspaceorcheck_resolve_keyspace(keyspace)self.query=f"SELECT * FROM {_keyspace}.{table};"self.metadata={"table":table,"keyspace":_keyspace}else:self.query=query# type: ignore[assignment]self.metadata={}self.session=sessionorcheck_resolve_session(session)self.page_content_mapper=page_content_mapperself.metadata_mapper=metadata_mapperself.query_kwargs={"parameters":query_parameters,"trace":query_trace,"custom_payload":query_custom_payload,"paging_state":query_paging_state,"host":query_host,"execute_as":query_execute_as,}ifquery_timeoutisnot_NOT_SET:self.query_kwargs["timeout"]=query_timeoutifquery_execution_profileisnot_NOT_SET:self.query_kwargs["execution_profile"]=query_execution_profile