@@ -717,11 +717,9 @@ def application_info(self) -> Optional[ApplicationInfoBase]:
717717 @property
718718 def auth_provider (self ):
719719 """
720- When :attr:`~.Cluster.protocol_version` is 2 or higher, this should
721- be an instance of a subclass of :class:`~cassandra.auth.AuthProvider`,
720+ This should be an instance of a subclass of :class:`~cassandra.auth.AuthProvider`,
722721 such as :class:`~.PlainTextAuthProvider`.
723722
724-
725723 When not using authentication, this should be left as :const:`None`.
726724 """
727725 return self ._auth_provider
@@ -735,12 +733,7 @@ def auth_provider(self, value):
735733 try :
736734 self ._auth_provider_callable = value .new_authenticator
737735 except AttributeError :
738- if self .protocol_version > 1 :
739- raise TypeError ("auth_provider must implement the cassandra.auth.AuthProvider "
740- "interface when protocol_version >= 2" )
741- elif not callable (value ):
742- raise TypeError ("auth_provider must be callable when protocol_version == 1" )
743- self ._auth_provider_callable = value
736+ raise TypeError ("auth_provider must implement the cassandra.auth.AuthProvider interface" )
744737
745738 self ._auth_provider = value
746739
@@ -1557,7 +1550,7 @@ def register_user_type(self, keyspace, user_type, klass):
15571550
15581551 Example::
15591552
1560- cluster = Cluster(protocol_version=3 )
1553+ cluster = Cluster(protocol_version=4 )
15611554 session = cluster.connect()
15621555 session.set_keyspace('mykeyspace')
15631556 session.execute("CREATE TYPE address (street text, zipcode int)")
@@ -1582,11 +1575,6 @@ def __init__(self, street, zipcode):
15821575 print(row.id, row.location.street, row.location.zipcode)
15831576
15841577 """
1585- if self .protocol_version < 3 :
1586- log .warning ("User Type serialization is only supported in native protocol version 3+ (%d in use). "
1587- "CQL encoding for simple statements will still work, but named tuples will "
1588- "be returned when reading type %s.%s." , self .protocol_version , keyspace , user_type )
1589-
15901578 self ._user_types [keyspace ][user_type ] = klass
15911579 for session in tuple (self .sessions ):
15921580 session .user_type_registered (keyspace , user_type , klass )
@@ -2445,8 +2433,6 @@ def default_serial_consistency_level(self):
24452433 The default :class:`~ConsistencyLevel` for serial phase of conditional updates executed through
24462434 this session. This default may be overridden by setting the
24472435 :attr:`~.Statement.serial_consistency_level` on individual statements.
2448-
2449- Only valid for ``protocol_version >= 2``.
24502436 """
24512437 return self ._default_serial_consistency_level
24522438
@@ -2957,11 +2943,6 @@ def _create_response_future(self, query, parameters, trace, custom_payload,
29572943 continuous_paging_options = continuous_paging_options ,
29582944 result_metadata_id = prepared_statement .result_metadata_id )
29592945 elif isinstance (query , BatchStatement ):
2960- if self ._protocol_version < 2 :
2961- raise UnsupportedOperation (
2962- "BatchStatement execution is only supported with protocol version "
2963- "2 or higher (supported in Cassandra 2.0 and higher). Consider "
2964- "setting Cluster.protocol_version to 2 to support this operation." )
29652946 statement_keyspace = query .keyspace if ProtocolVersion .uses_keyspace_flag (self ._protocol_version ) else None
29662947 message = BatchMessage (
29672948 query .batch_type , query ._statements_and_parameters , cl ,
@@ -3100,7 +3081,7 @@ def prepare(self, query, custom_payload=None, keyspace=None):
31003081 prepared_keyspace = keyspace if keyspace else None
31013082 prepared_statement = PreparedStatement .from_message (
31023083 response .query_id , response .bind_metadata , response .pk_indexes , self .cluster .metadata , query , prepared_keyspace ,
3103- self . _protocol_version , response .column_metadata , response .result_metadata_id , response .is_lwt , self .cluster .column_encryption_policy )
3084+ response .column_metadata , response .result_metadata_id , response .is_lwt , self .cluster .column_encryption_policy )
31043085 prepared_statement .custom_payload = future .custom_payload
31053086
31063087 self .cluster .add_prepared (response .query_id , prepared_statement )
@@ -4640,10 +4621,9 @@ def _set_result(self, host, connection, pool, response):
46404621 self ._custom_payload = getattr (response , 'custom_payload' , None )
46414622
46424623 if self ._custom_payload and self .session .cluster .control_connection ._tablets_routing_v1 and 'tablets-routing-v1' in self ._custom_payload :
4643- protocol = self .session .cluster .protocol_version
46444624 info = self ._custom_payload .get ('tablets-routing-v1' )
46454625 ctype = types .lookup_casstype ('TupleType(LongType, LongType, ListType(TupleType(UUIDType, Int32Type)))' )
4646- tablet_routing_info = ctype .from_binary (info , protocol )
4626+ tablet_routing_info = ctype .from_binary (info )
46474627 first_token = tablet_routing_info [0 ]
46484628 last_token = tablet_routing_info [1 ]
46494629 tablet_replicas = tablet_routing_info [2 ]
0 commit comments