简体   繁体   English

/ infos /处没有OperationalError Django导入在python中正常工作的sqlite3数据库时没有此类表Django

[英]OperationalError at /infos/ no such table Django while importing an sqlite3 database that works properly in python

I've searched on stackover and Django official website, and other forums, but didn't find the answer that I needed.我在stackover和Django官方网站以及其他论坛上进行了搜索,但没有找到所需的答案。 I have this error while trying to make queries on an imported existing sqlite3 database, given that I don't want to generate a model, I just need to query the exisiting database and knowing that the same code works fine in python.考虑到我不想生成模型,我在尝试对导入的现有sqlite3数据库进行查询时遇到此错误,我只需要查询现有数据库,并且知道相同的代码在python中可以正常工作。 Here is the code : Any help will be greatly appreciated!这里是代码:任何帮助将不胜感激!

def get_classification_result(carcat):
      from sklearn.tree import DecisionTreeClassifier
      tree_object = DecisionTreeClassifier (criterion='entropy', max_depth=3, random_state=0)

      from sklearn.svm import SVC
      svm_object = SVC (probability=True)

      # from sklearn.naive_bayes import GaussianNB
      # bayes_object = GaussianNB()
      from sklearn.neural_network import MLPClassifier
      mlp = MLPClassifier (solver='lbfgs', alpha=1e-5, hidden_layer_sizes=(5, 2), random_state=1)
      from sklearn.model_selection import cross_val_score
      DP = np.zeros((3, 20, 2))
      database_loc = '..\\Data\\compData.db'
      database = sqlite3.connect(database_loc)
      data = database.cursor()
      start_time = time.time()
      train_patients_count = 50
      test_patients_count = 20
      X_array = []
      Y_array = []
      patientIDs = data.execute('SELECT DISTINCT PatientGuid FROM training_patient').fetchall()  # patientIDs is list of all patients
      # Error happens here!!!
      os.system("clear")

I've searched on stackover and Django official website, and other forums, but didn't find the answer that I needed.我在stackover和Django官方网站以及其他论坛上进行了搜索,但没有找到所需的答案。 I have this error while trying to make queries on an imported existing sqlite3 database, given that I don't want to generate a model, I just need to query the exisiting database and knowing that the same code works fine in python.考虑到我不想生成模型,我在尝试对导入的现有sqlite3数据库进行查询时遇到此错误,我只需要查询现有数据库,并且知道相同的代码在python中可以正常工作。 Here is the code : Any help will be greatly appreciated!这里是代码:任何帮助将不胜感激!

def get_classification_result(carcat):
      from sklearn.tree import DecisionTreeClassifier
      tree_object = DecisionTreeClassifier (criterion='entropy', max_depth=3, random_state=0)

      from sklearn.svm import SVC
      svm_object = SVC (probability=True)

      # from sklearn.naive_bayes import GaussianNB
      # bayes_object = GaussianNB()
      from sklearn.neural_network import MLPClassifier
      mlp = MLPClassifier (solver='lbfgs', alpha=1e-5, hidden_layer_sizes=(5, 2), random_state=1)
      from sklearn.model_selection import cross_val_score
      DP = np.zeros((3, 20, 2))
      database_loc = '..\\Data\\compData.db'
      database = sqlite3.connect(database_loc)
      data = database.cursor()
      start_time = time.time()
      train_patients_count = 50
      test_patients_count = 20
      X_array = []
      Y_array = []
      patientIDs = data.execute('SELECT DISTINCT PatientGuid FROM training_patient').fetchall()  # patientIDs is list of all patients
      # Error happens here!!!
      os.system("clear")

I've searched on stackover and Django official website, and other forums, but didn't find the answer that I needed.我在stackover和Django官方网站以及其他论坛上进行了搜索,但没有找到所需的答案。 I have this error while trying to make queries on an imported existing sqlite3 database, given that I don't want to generate a model, I just need to query the exisiting database and knowing that the same code works fine in python.考虑到我不想生成模型,我在尝试对导入的现有sqlite3数据库进行查询时遇到此错误,我只需要查询现有数据库,并且知道相同的代码在python中可以正常工作。 Here is the code : Any help will be greatly appreciated!这里是代码:任何帮助将不胜感激!

def get_classification_result(carcat):
      from sklearn.tree import DecisionTreeClassifier
      tree_object = DecisionTreeClassifier (criterion='entropy', max_depth=3, random_state=0)

      from sklearn.svm import SVC
      svm_object = SVC (probability=True)

      # from sklearn.naive_bayes import GaussianNB
      # bayes_object = GaussianNB()
      from sklearn.neural_network import MLPClassifier
      mlp = MLPClassifier (solver='lbfgs', alpha=1e-5, hidden_layer_sizes=(5, 2), random_state=1)
      from sklearn.model_selection import cross_val_score
      DP = np.zeros((3, 20, 2))
      database_loc = '..\\Data\\compData.db'
      database = sqlite3.connect(database_loc)
      data = database.cursor()
      start_time = time.time()
      train_patients_count = 50
      test_patients_count = 20
      X_array = []
      Y_array = []
      patientIDs = data.execute('SELECT DISTINCT PatientGuid FROM training_patient').fetchall()  # patientIDs is list of all patients
      # Error happens here!!!
      os.system("clear")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM