0

我有一个允许您编写 SQL 查询的应用程序,它在我制作的 GridDB 容器上运行它。我测试了部署的应用程序,并以某种方式尝试使用 DELETE 语句从存储数据库的 GridDB 容器中删除前两行,从那时起,这些行就消失了,它们不再出现在应用程序的数据库中. 有没有办法可以从容器或数据库后端再次访问已删除的行?这是后端控制数据库的代码。

#...
import pandas as pd
import griddb_python as griddb
factory = griddb.StoreFactory.get_instance()

#...
def backend(self, query):
    try:
        gridstore = factory.get_store(host="127.0.0.1", port="8080", 
                cluster_name="Clst", username="root", 
                password="")
        conInfo = griddb.ContainerInfo("BiologyTest",
                    [              
                     ["First Name", griddb.Type.STRING],
                     ["Last Name", griddb.Type.STRING],
                     ["Test Score", griddb.Type.INTEGER],
                    ],
                    griddb.ContainerType.COLLECTION, True)
        container = gridstore.put_container(conInfo) 
        container.create_index("id", griddb.IndexType.DEFAULT)  
        data = pd.read_csv("dataset.csv")


        # Adding the database
        for i in range(len(data)):
            ret = container.put(data.iloc[i, :])

    except Exception as e:
        print(e)

    # Where the code reads the query from the user
    sql_statement = (f'{query}')
    sql_query = pd.read_sql_query(sql_statement, container)
    # Can I possibly reverse statements?
    #...
4

0 回答 0