How to use the verticapy.vertica_cursor function in verticapy

To help you get started, we’ve selected a few verticapy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vertica / Vertica-ML-Python / verticapy / utilities.py View on Github external
("name", name, [str], False), 
		("dsn", dsn, [str], False), 
		("schema", schema, [str], False),
		("history", history, [list], False),
		("saving", saving, [list], False),
		("query_on", query_on, [bool], False),
		("time_on", time_on, [bool], False)])
	name = gen_name([name])
	from verticapy import vDataFrame
	vdf = vDataFrame("", empty = True)
	vdf._VERTICAPY_VARIABLES_["dsn"] = dsn
	if not(cursor) and not(dsn):
		cursor = read_auto_connect().cursor()
	elif not(cursor):
		from verticapy import vertica_cursor
		cursor = vertica_cursor(dsn)
	else:
		check_cursor(cursor)
	vdf._VERTICAPY_VARIABLES_["input_relation"] = name
	vdf._VERTICAPY_VARIABLES_["main_relation"] = relation
	vdf._VERTICAPY_VARIABLES_["schema"] = schema
	vdf._VERTICAPY_VARIABLES_["schema_writing"] = schema_writing
	vdf._VERTICAPY_VARIABLES_["cursor"] = cursor
	vdf._VERTICAPY_VARIABLES_["query_on"] = query_on
	vdf._VERTICAPY_VARIABLES_["time_on"] = time_on
	vdf._VERTICAPY_VARIABLES_["where"] = []
	vdf._VERTICAPY_VARIABLES_["order_by"] = {}
	vdf._VERTICAPY_VARIABLES_["exclude_columns"] = []
	vdf._VERTICAPY_VARIABLES_["history"] = history
	vdf._VERTICAPY_VARIABLES_["saving"] = saving
	try:
		cursor.execute("DROP TABLE IF EXISTS v_temp_schema.VERTICAPY_{}_TEST;".format(name))
github vertica / Vertica-ML-Python / verticapy / utilities.py View on Github external
Returns
 	-------
 	vDataFrame
 		vDataFrame of the tablesample.

	See Also
	--------
	tablesample.to_pandas : Converts the tablesample to a pandas DataFrame.
	tablesample.to_sql    : Generates the SQL query associated to the tablesample.
		"""
		check_types([("dsn", dsn, [str], False)])
		if not(cursor) and not(dsn):
			cursor = read_auto_connect().cursor()
		elif not(cursor):
			from verticapy import vertica_cursor
			cursor = vertica_cursor(dsn)
		else:
			check_cursor(cursor)
		relation = "({}) sql_relation".format(self.to_sql())
		return (vdf_from_relation(relation, cursor = cursor, dsn = dsn)) 
#---#