Class GPUdb
This is the main class to be used to provide the client functionality to interact with the server.
Usage patterns
Secured setup (Default)
This code given below will set up a secured connection. The property ‘skip_ssl_cert_verification’ is set to ‘False’ by default. SSL certificate check will be enforced by default.
Unsecured setup
The code given below will set up an unsecured connection to the server. The property ‘skip_ssl_cert_verification’ has been set explicitly to ‘True’. So, irrespective of whether an SSL setup is there or not all certificate checks will be bypassed.
Another way of setting up an unsecured connection is as given by the code below. In this case, the URL is not a secured one so no SSL setup comes into play.
Construct a new GPUdb client instance. This object communicates to the database server at the given address. This class implements HA failover, which means that upon certain error conditions, this class will try to establish connection with one of the other clusters (specified by the user or known to the ring) to continue service. There are several options related to how to control that in the GPUdb.Options class that can be controlled via options.
Note
Please read the docstring of options about backward- compatibility related notes.
Parameters
The URL(s) of the GPUdb server. May be provided as a comma separated string or a list of strings containing head or worker rank URLs of the server clusters. Must be full and valid URLs. Example: “https://domain.com:port/path/”. If only a single URL or host is given, and no primary_url is explicitly specified via the options, then the given URL will be used as the primary URL. Default is ‘http://127.0.0.1:9191’ (implemented internally).
Note that in versions 7.0 and prior, the URL also allowed username:password@ in front of the hostname. That is now deprecated. For now, anything in the hostname separated by the @ symbol will be discarded. (But the constructor will still function). Please use the appropriate properties of the options argument to set the username and password.
Optional arguments for creating this GPUdb object. To be backward compatible to 7.0 versions, keyword arguments will be honored (only if no options is given). I.e., if options is given, no positional or keyword argument can be given. See Options for all available properties.
See also
Inner enumeration class to represent the high-availability synchronicity override mode that is applied to each endpoint call. Available enumerations are:
DEFAULT – No override; defer to the HA process for synchronizing endpoints (which has different logic for different endpoints). This is the default mode.
NONE – Do not replicate the endpoint calls to the backup cluster.
SYNCHRONOUS – Synchronize all endpoint calls
ASYNCHRONOUS – Do NOT synchronize any endpoint call
Inner enumeration class to represent the high-availability failover order that is applied to ring resiliency or inter-cluster failover. The order dictates in which pattern backup clusters will be chosen when a failover needs to happen in the client API. Available enumerations are:
RANDOM – Randomly choose the backup cluster from the available clusters. This is the default mode.
SEQUENTIAL – Choose the cluster sequentially from the list of clusters (the union of the user given clusters and auto-discovered clusters).
Encapsulates the various options used to create a GPUdb object. The same object can be used on multiple GPUdb client handles and state modifications are chained together:
For backward compatibility, we will support the following options from the 7.0 GPUdb keyword arguments and map them to the following properties:
connection -> protocol
no_init_db_contact -> disable_auto_discovery
Create a default set of options for GPUdb object creation.
Parameters
GPUdb.Options) –Optional dictionary with options already loaded. If a GPUdb.Options object, then this will work like a copy constructor and make a full copy of the input argument.
Returns
An Options object.
An internal class to handle Kinetica Version (client API or server).
Takes in a string containing a Kinetica version and creates a GPUdb.Version object from it.
Parameters
A string containing the Kinetica version (client or server). Expect at least four components separated by a period (.). There may be additional parts after the fourth component that will be discarded.
An internal class to handle connection URL parsing
An internal class to handle URLs. Stores the hostname/IP address, port, protocol, path, and the full URL (as a string).
Takes in a string containing a full URL, or another URL object, and creates a URL object from it.
Parameters
Either a hostname/URL string or another GPUdb.URL object to create this object for. Note that the port is not a mandatory part of the URL.
Optional port. If specified, will be appended to any host specified and will override the port of any URL specified.
Optional protocol. If specified, will be prepended to any host specified and will override the protocol of any URL specified.
Optional argument. If False, then be flexible in the parsing; for example, if no port is given, use the default port. If True, then only accept full URLs only. Default is False.
Inner class to keep track of all relevant information for a given Kinetica cluster. It mostly keeps track of URLs and hostnames, with some additional information like whether the cluster is primary or not.
Creates a ClusterAddressInfo object with the given information.
Parameters
GPUdb.URL) –Only required argument. Must be a full URL string or GPUdb.URL object. E.g. “http://1.2.3.4:8082/gpudb-0”.
GPUdb.URL) –Optional argument. Must be a list of fully qualified URLs. These URLs correspond to the worker ranks’ addresses.
Optional argument. Must be a list of strings. These strings contain hostnames or IP addresses for all the nodes/hosts in the cluster. May contain the protocol (e.g. “http://host0”).
GPUdb.URL) –Optional argument, mutually exclusive with host_manager_port. If given, must be a fully qualified URL for the host manager of this cluster.
Optional argument, mutually exclusive with host_manager_url. If given, must be an integer in the range [1, 65535].
Optional boolean argument. Indicates if this cluster is to be treated as the primary cluster. Default is False.
GPUdb.Version) –Optional string containing the server version. If given, will be parsed as a GPUdb.Version object. Default is None.
Optional last-seen HA drain state for this cluster, as reported by the ‘ha_status.drained’ field of /show/system/status (e.g. “drained”, “draining”, “not_drained”). None if unknown or not applicable (e.g. a non-HA cluster). Default is None.
Optional level at which logs should be output. Default is None.