diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 404850a79..f49b0279c 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.6, 3.7, 3.8] + python-version: [3.7, 3.8, 3.9] steps: - name: Check out repository diff --git a/setup.py b/setup.py index f16927ea8..f9af6e4c2 100644 --- a/setup.py +++ b/setup.py @@ -57,6 +57,7 @@ "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", "Topic :: Database", "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent", diff --git a/tox.ini b/tox.ini index ecfd16125..8ac9433ad 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py36,py37,py38 +envlist = py37,py38,py39 [testenv] passenv = * diff --git a/verticapy/connect.py b/verticapy/connect.py index 658e8988c..eacaf0c60 100755 --- a/verticapy/connect.py +++ b/verticapy/connect.py @@ -494,7 +494,7 @@ def set_external_connection(cid: str, rowset: int = 500, symbol: str = "$"): SQLFetch() cycle. symbol: str, optional One of the following: - "$", "€", "£", "%", "@", "&", "§", "%", "?", "!" + "$", "€", "£", "%", "@", "&", "§", "?", "!" A special character, to identify the connection. For example, if the symbol is '$', you can call external tables with the input cid by writing $$$QUERY$$$, where QUERY represents diff --git a/verticapy/learn/tools.py b/verticapy/learn/tools.py index ba773df3a..a60316c36 100755 --- a/verticapy/learn/tools.py +++ b/verticapy/learn/tools.py @@ -83,16 +83,6 @@ def does_model_exist( 1 if the model exists and is native. 2 if the model exists and is not native. """ - # Saving information to the query profile table - save_to_query_profile( - name="does_model_exist", - path="learn.tools", - json_dict={ - "name": name, - "raise_error": raise_error, - "return_model_type": return_model_type, - }, - ) # -# check_types([("name", name, [str])]) model_type = None diff --git a/verticapy/utilities.py b/verticapy/utilities.py index 04c0266e8..5280b7484 100644 --- a/verticapy/utilities.py +++ b/verticapy/utilities.py @@ -195,12 +195,6 @@ def create_schema( bool True if the schema was successfully created, False otherwise. """ - # Saving information to the query profile table - save_to_query_profile( - name="create_schema", - path="utilities", - json_dict={"schema": schema, "raise_error": raise_error,}, - ) # -# check_types( [("schema", schema, [str]), ("raise_error", raise_error, [bool]),] @@ -254,20 +248,6 @@ def create_table( bool True if the table was successfully created, False otherwise. """ - # Saving information to the query profile table - save_to_query_profile( - name="create_table", - path="utilities", - json_dict={ - "table_name": table_name, - "schema": schema, - "dtype": dtype, - "genSQL": genSQL, - "temporary_table": temporary_table, - "temporary_local_table": temporary_local_table, - "raise_error": raise_error, - }, - ) # -# check_types( [ @@ -316,10 +296,6 @@ def create_verticapy_schema(): --------------------------------------------------------------------------- Creates a schema named 'verticapy' used to store VerticaPy extended models. """ - # Saving information to the query profile table - save_to_query_profile( - name="create_verticapy_schema", path="utilities", json_dict={}, - ) sql = "CREATE SCHEMA IF NOT EXISTS verticapy;" executeSQL(sql, title="Creating VerticaPy schema.") sql = """CREATE TABLE IF NOT EXISTS verticapy.models (model_name VARCHAR(128), @@ -365,12 +341,6 @@ def drop(name: str = "", method: str = "auto", raise_error: bool = False, **kwds bool True if the relation was dropped, False otherwise. """ - # Saving information to the query profile table - save_to_query_profile( - name="drop", - path="utilities", - json_dict={"name": name, "method": method, "raise_error": raise_error,}, - ) # -# if "relation_type" in kwds and method == "auto": method = kwds["relation_type"] @@ -594,18 +564,6 @@ def get_data_types( list of tuples The list of the different columns and their respective type. """ - # Saving information to the query profile table - save_to_query_profile( - name="get_data_types", - path="utilities", - json_dict={ - "expr": expr, - "column": column, - "table_name": table_name, - "schema": schema, - "usecols": usecols, - }, - ) # -# check_types( [ @@ -987,10 +945,6 @@ def isvmap( bool True if the column is a VMap. """ - # Saving information to the query profile table - save_to_query_profile( - name="isvmap", path="utilities", json_dict={"expr": expr, "column": column,}, - ) # -# from verticapy import vDataFrame from verticapy.connect import current_cursor @@ -1279,29 +1233,6 @@ def pcsv( read_csv : Ingests a CSV file into the Vertica database. read_json : Ingests a JSON file into the Vertica database. """ - # Saving information to the query profile table - save_to_query_profile( - name="pcsv", - path="utilities", - json_dict={ - "path": path, - "sep": sep, - "header": header, - "header_names": header_names, - "na_rep": na_rep, - "quotechar": quotechar, - "escape": escape, - "record_terminator": record_terminator, - "trim": trim, - "omit_empty_keys": omit_empty_keys, - "reject_on_duplicate": reject_on_duplicate, - "reject_on_empty_key": reject_on_empty_key, - "reject_on_materialized_type_error": reject_on_materialized_type_error, - "ingest_local": ingest_local, - "flex_name": flex_name, - }, - ) - # -# if record_terminator == "\n": record_terminator = "\\n" if not (flex_name): @@ -1388,13 +1319,6 @@ def pjson(path: str, ingest_local: bool = True): read_csv : Ingests a CSV file into the Vertica database. read_json : Ingests a JSON file into the Vertica database. """ - # Saving information to the query profile table - save_to_query_profile( - name="pjson", - path="utilities", - json_dict={"path": path, "ingest_local": ingest_local,}, - ) - # -# flex_name = gen_tmp_name(name="flex")[1:-1] executeSQL( f"CREATE FLEX LOCAL TEMP TABLE {flex_name}(x int) ON COMMIT PRESERVE ROWS;", @@ -2940,12 +2864,6 @@ def set_option(option: str, value: Union[bool, int, str] = None): value: object, optional New value of option. """ - # Saving information to the query profile table - save_to_query_profile( - name="set_option", - path="utilities", - json_dict={"option": option, "value": value,}, - ) # -# if isinstance(option, str): option = option.lower() @@ -3639,12 +3557,6 @@ def to_tablesample( -------- tablesample : Object in memory created for rendering purposes. """ - # Saving information to the query profile table - save_to_query_profile( - name="to_tablesample", - path="utilities", - json_dict={"query": query, "title": title, "max_columns": max_columns,}, - ) # -# check_types( [("query", query, [str]), ("max_columns", max_columns, [int]),] @@ -3797,10 +3709,6 @@ def version(condition: list = []): List containing the version information. [MAJOR, MINOR, PATCH, POST] """ - # Saving information to the query profile table - save_to_query_profile( - name="version", path="utilities", json_dict={"condition": condition,}, - ) # -# check_types([("condition", condition, [list])]) if condition: diff --git a/verticapy/vcolumn.py b/verticapy/vcolumn.py index 1ba573485..0f92a5348 100755 --- a/verticapy/vcolumn.py +++ b/verticapy/vcolumn.py @@ -366,10 +366,6 @@ def add_copy(self, name: str): -------- vDataFrame.eval : Evaluates a customized expression. """ - # Saving information to the query profile table - save_to_query_profile( - name="add_copy", path="vcolumn.vColumn", json_dict={"name": name,}, - ) # -# check_types([("name", name, [str])]) name = quote_ident(name.replace('"', "_")) @@ -1869,11 +1865,6 @@ def distinct(self, **kwargs): -------- vDataFrame.topk : Returns the vColumn most occurent elements. """ - # Saving information to the query profile table - save_to_query_profile( - name="distinct", path="vcolumn.vColumn", json_dict={}, - ) - # -# if "agg" not in kwargs: query = "SELECT /*+LABEL('vColumn.distinct')*/ {0} AS {1} FROM {2} WHERE {1} IS NOT NULL GROUP BY {1} ORDER BY {1}".format( bin_spatial_to_str(self.category(), self.alias), @@ -2641,11 +2632,6 @@ def head(self, limit: int = 5): -------- vDataFrame[].tail : Returns the a part of the vColumn. """ - # Saving information to the query profile table - save_to_query_profile( - name="head", path="vcolumn.vColumn", json_dict={"limit": limit,}, - ) - # -# return self.iloc(limit=limit) # ---# @@ -2754,12 +2740,6 @@ def iloc(self, limit: int = 5, offset: int = 0): vDataFrame[].head : Returns the head of the vColumn. vDataFrame[].tail : Returns the tail of the vColumn. """ - # Saving information to the query profile table - save_to_query_profile( - name="iloc", - path="vcolumn.vColumn", - json_dict={"limit": limit, "offset": offset,}, - ) # -# check_types([("limit", limit, [int, float]), ("offset", offset, [int, float])]) if offset < 0: @@ -3760,10 +3740,6 @@ def numh(self, method: str = "auto"): float optimal bar width. """ - # Saving information to the query profile table - save_to_query_profile( - name="numh", path="vcolumn.vColumn", json_dict={"method": method,}, - ) # -# check_types( [("method", method, ["sturges", "freedman_diaconis", "fd", "auto"])] @@ -4758,11 +4734,6 @@ def tail(self, limit: int = 5): -------- vDataFrame[].head : Returns the head of the vColumn. """ - # Saving information to the query profile table - save_to_query_profile( - name="tail", path="vcolumn.vColumn", json_dict={"limit": limit,}, - ) - # -# return self.iloc(limit=limit, offset=-1) # ---# diff --git a/verticapy/vdataframe.py b/verticapy/vdataframe.py index ded5d3fef..4a31d20dc 100755 --- a/verticapy/vdataframe.py +++ b/verticapy/vdataframe.py @@ -70,7 +70,7 @@ from verticapy.toolbox import * from verticapy.errors import * -## +### # _____ # _______ ______ ____________ ____ \ \ # \ | | |\ \ \ \ /____/| @@ -127,7 +127,7 @@ class vDataFrame: See the connect.set_external_connection function for more information. symbol: str, optional One of the following: - "$", "€", "£", "%", "@", "&", "§", "%", "?", "!" + "$", "€", "£", "%", "@", "&", "§", "?", "!" Symbol used to identify the external connection. See the connect.set_external_connection function for more information. sql_push_ext: bool, optional @@ -151,8 +151,10 @@ class vDataFrame: (catalog). exclude_columns, list : vColumns to exclude from the final relation. + external, bool : True if it is an External vDataFrame. history, list : vDataFrame history (user modifications). input_relation, str : Name of the vDataFrame. + isflex, bool : True if it is a Flex vDataFrame. main_relation, str : Relation to use to build the vDataFrame (first floor). order_by, dict : Dictionary of all rules to sort the @@ -186,22 +188,6 @@ def __init__( sql_push_ext: bool = True, empty: bool = False, ): - # Saving information to the query profile table - save_to_query_profile( - name="__init__", - path="vdataframe.vDataFrame", - json_dict={ - "input_relation": input_relation, - "columns": columns, - "usecols": usecols, - "schema": schema, - "sql": sql, - "external": external, - "symbol": symbol, - "sql_push_ext": sql_push_ext, - "empty": empty, - }, - ) # Initialization if not (isinstance(input_relation, (pd.DataFrame, np.ndarray))): assert input_relation or sql or empty, ParameterError( @@ -4348,12 +4334,6 @@ def catcol(self, max_cardinality: int = 12): vDataFrame.numcol : Returns a list of names of the numerical vColumns in the vDataFrame. """ - # Saving information to the query profile table - save_to_query_profile( - name="catcol", - path="vdataframe.vDataFrame", - json_dict={"max_cardinality": max_cardinality,}, - ) # -# check_types([("max_cardinality", max_cardinality, [int, float])]) columns = [] @@ -4745,11 +4725,6 @@ def copy(self): vDataFrame The copy of the vDataFrame. """ - # Saving information to the query profile table - save_to_query_profile( - name="copy", path="vdataframe.vDataFrame", json_dict={}, - ) - # -# copy_vDataFrame = vDataFrame("", empty=True) copy_vDataFrame._VERTICAPY_VARIABLES_[ "input_relation" @@ -5578,13 +5553,6 @@ def current_relation(self, reindent: bool = True): str The formatted current vDataFrame relation. """ - # Saving information to the query profile table - save_to_query_profile( - name="current_relation", - path="vdataframe.vDataFrame", - json_dict={"reindent": reindent,}, - ) - # -# if reindent: return indentSQL(self.__genSQL__()) else: @@ -5607,11 +5575,6 @@ def datecol(self): vDataFrame.numcol : Returns a list of names of the numerical vColumns in the vDataFrame. """ - # Saving information to the query profile table - save_to_query_profile( - name="datecol", path="vdataframe.vDataFrame", json_dict={}, - ) - # -# columns = [] cols = self.get_columns() for column in cols: @@ -5630,11 +5593,6 @@ def del_catalog(self): vDataFrame self """ - # Saving information to the query profile table - save_to_query_profile( - name="del_catalog", path="vdataframe.vDataFrame", json_dict={}, - ) - # -# self.__update_catalog__(erase=True) return self @@ -6425,11 +6383,6 @@ def empty(self): bool True if the vDataFrame has no vColumns. """ - # Saving information to the query profile table - save_to_query_profile( - name="empty", path="vdataframe.vDataFrame", json_dict={}, - ) - # -# return not (self.get_columns()) # ---# @@ -6996,12 +6949,6 @@ def get_columns(self, exclude_columns: list = []): vDataFrame.datecol : Returns all vDataFrame vColumns of type date. vDataFrame.numcol : Returns all numerical vDataFrame vColumns. """ - # Saving information to the query profile table - save_to_query_profile( - name="get_columns", - path="vdataframe.vDataFrame", - json_dict={"exclude_columns": exclude_columns,}, - ) # -# if isinstance(exclude_columns, str): exclude_columns = [columns] @@ -7531,11 +7478,6 @@ def head(self, limit: int = 5): -------- vDataFrame.tail : Returns the vDataFrame tail. """ - # Saving information to the query profile table - save_to_query_profile( - name="head", path="vdataframe.vDataFrame", json_dict={"limit": limit,}, - ) - # -# return self.iloc(limit=limit, offset=0) # ---# @@ -7875,12 +7817,6 @@ def iloc(self, limit: int = 5, offset: int = 0, columns: list = []): vDataFrame.head : Returns the vDataFrame head. vDataFrame.tail : Returns the vDataFrame tail. """ - # Saving information to the query profile table - save_to_query_profile( - name="iloc", - path="vdataframe.vDataFrame", - json_dict={"limit": limit, "offset": offset, "columns": columns,}, - ) # -# if isinstance(columns, str): columns = [columns] @@ -7953,11 +7889,6 @@ def info(self): str information on the vDataFrame modifications """ - # Saving information to the query profile table - save_to_query_profile( - name="info", path="vdataframe.vDataFrame", json_dict={}, - ) - # -# if len(self._VERTICAPY_VARIABLES_["history"]) == 0: result = "The vDataFrame was never modified." elif len(self._VERTICAPY_VARIABLES_["history"]) == 1: @@ -8746,13 +8677,6 @@ def numcol(self, exclude_columns: list = []): vDataFrame.catcol : Returns the categorical type vColumns in the vDataFrame. vDataFrame.get_columns : Returns the vColumns of the vDataFrame. """ - # Saving information to the query profile table - save_to_query_profile( - name="numcol", - path="vdataframe.vDataFrame", - json_dict={"exclude_columns": exclude_columns,}, - ) - # -# columns, cols = [], self.get_columns(exclude_columns=exclude_columns) for column in cols: if self[column].isnum(): @@ -11338,11 +11262,6 @@ def shape(self): tuple (number of lines, number of columns) """ - # Saving information to the query profile table - save_to_query_profile( - name="shape", path="vdataframe.vDataFrame", json_dict={}, - ) - # -# m = len(self.get_columns()) pre_comp = self.__get_catalog_value__("VERTICAPY_COUNT") if pre_comp != "VERTICAPY_NOT_PRECOMPUTED": @@ -11675,11 +11594,6 @@ def tail(self, limit: int = 5): -------- vDataFrame.head : Returns the vDataFrame head. """ - # Saving information to the query profile table - save_to_query_profile( - name="tail", path="vdataframe.vDataFrame", json_dict={"limit": limit,}, - ) - # -# return self.iloc(limit=limit, offset=-1) # ---# @@ -12702,11 +12616,6 @@ def version(self): List containing the version information. [MAJOR, MINOR, PATCH, POST] """ - # Saving information to the query profile table - save_to_query_profile( - name="version", path="vdataframe.vDataFrame", json_dict={}, - ) - # -# from verticapy.utilities import version as vertica_version return vertica_version()