如何删除由 VerticaPy 创建的临时 table - 错误 table "v_temp_schema"."train" 已经存在
How to delete temp table created by VerticaPy - error the table "v_temp_schema"."train" already exists
我想使用 VerticaPy
- https://www.vertica.com/python/documentation_last/utilities/read_csv/
读取 csv
文件
我正在 运行宁 Vertica
在笔记本电脑上使用 Docker
图片。
Jupyter
代码是
import sys
!{sys.executable} -m pip install vertica-python
!{sys.executable} -m pip install verticapy
from verticapy import *
conn_info = {'host': '127.0.0.1',
'port': 5433,
'user': 'dbadmin',
'password': '',
'database': 'kaggle_titanic'}
train = read_csv("train.csv")
train
代码 运行 第一次没问题,但当我再次 运行 时,出现错误
NameError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_8344/783506563.py in <module>
23 # cur.execute("drop table kaggle_titanic.v_temp_schema.train")
24
---> 25 train = read_csv("train.csv")
26 train
27 #iris2
~\Anaconda3\lib\site-packages\verticapy\utilities.py in read_csv(path, cursor, schema, table_name, sep, header, header_names, dtype, na_rep, quotechar, escape, genSQL, parse_n_lines, insert, temporary_table, temporary_local_table, ingest_local)
918 result = cursor.fetchall()
919 if (result != []) and not (insert):
--> 920 raise NameError(
921 'The table "{}"."{}" already exists !'.format(schema, table_name)
922 )
NameError: The table "v_temp_schema"."train" already exists !
看起来 VerticaPy
在第一个 运行 中创建了一个临时文件 table。如何删除它?
我尝试添加此代码
with vertica_python.connect(**conn_info) as conn:
cur = conn.cursor()
cur.execute("drop table kaggle_titanic.v_temp_schema.train")
但是出现错误
MissingSchema: Severity: ROLLBACK, Message: Schema "v_temp_schema" does not exist, Sqlstate: 3F000, Routine: RangeVarGetObjid, File: /data/jenkins/workspace/RE-ReleaseBuilds/RE-Jackhammer_3/server/vertica/Catalog/Namespace.cpp, Line: 281, Error Code: 4650, SQL: 'drop table kaggle_titanic.v_temp_schema.train'
我不得不 stop/start 数据库(从 docker 图像)到 运行 代码,但显然这不是正确的方法。
如何删除 v_temp_schema.train
?
我在 Github 回复了这个请求:https://github.com/vertica/VerticaPy/issues/285
我想使用 VerticaPy
- https://www.vertica.com/python/documentation_last/utilities/read_csv/
csv
文件
我正在 运行宁 Vertica
在笔记本电脑上使用 Docker
图片。
Jupyter
代码是
import sys
!{sys.executable} -m pip install vertica-python
!{sys.executable} -m pip install verticapy
from verticapy import *
conn_info = {'host': '127.0.0.1',
'port': 5433,
'user': 'dbadmin',
'password': '',
'database': 'kaggle_titanic'}
train = read_csv("train.csv")
train
代码 运行 第一次没问题,但当我再次 运行 时,出现错误
NameError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_8344/783506563.py in <module>
23 # cur.execute("drop table kaggle_titanic.v_temp_schema.train")
24
---> 25 train = read_csv("train.csv")
26 train
27 #iris2
~\Anaconda3\lib\site-packages\verticapy\utilities.py in read_csv(path, cursor, schema, table_name, sep, header, header_names, dtype, na_rep, quotechar, escape, genSQL, parse_n_lines, insert, temporary_table, temporary_local_table, ingest_local)
918 result = cursor.fetchall()
919 if (result != []) and not (insert):
--> 920 raise NameError(
921 'The table "{}"."{}" already exists !'.format(schema, table_name)
922 )
NameError: The table "v_temp_schema"."train" already exists !
看起来 VerticaPy
在第一个 运行 中创建了一个临时文件 table。如何删除它?
我尝试添加此代码
with vertica_python.connect(**conn_info) as conn:
cur = conn.cursor()
cur.execute("drop table kaggle_titanic.v_temp_schema.train")
但是出现错误
MissingSchema: Severity: ROLLBACK, Message: Schema "v_temp_schema" does not exist, Sqlstate: 3F000, Routine: RangeVarGetObjid, File: /data/jenkins/workspace/RE-ReleaseBuilds/RE-Jackhammer_3/server/vertica/Catalog/Namespace.cpp, Line: 281, Error Code: 4650, SQL: 'drop table kaggle_titanic.v_temp_schema.train'
我不得不 stop/start 数据库(从 docker 图像)到 运行 代码,但显然这不是正确的方法。
如何删除 v_temp_schema.train
?
我在 Github 回复了这个请求:https://github.com/vertica/VerticaPy/issues/285