DatabaseError: Execution failed on sql : no such table: League











up vote
0
down vote

favorite












I am trying to connect to the sqllite3 database. But it says
DatabaseError: Execution failed on sql 'SELECT * FROM League': no such table: League



I have tried many ways to get through this.



import sqlite3
import os.path
import pandas as pd
import numpy as np
from matplotlib import pyplot as plt
from sklearn.cluster import KMeans
from sklearn.preprocessing import scale


#BASE_DIR = os.path.dirname(os.path.abspath(pat))
#database = os.path.join(BASE_DIR, "database.sqlite")

#with sqlite3.connect(database) as conn:
#
# print("Connection Successful",conn)
# df = pd.read_sql_query("SELECT * FROM Country", conn)

pat = r'C:UserspouruDownloadssoccer'
database = pat + 'database.sqlite'
conn = sqlite3.connect(database)
print("Connection Successful",conn)
df = pd.read_sql_query('SELECT * FROM League', conn)


It says connection successful but when I insert the last statement to get the table data, it produces the above error. I tried to solve it using the absolute path way like the code I have commented above but it gives the same error.



Can anyone give me an idea to solve this? I have tried with all the tables. It works well on the SQL interface but not in python.










share|improve this question






















  • Try replacing read_sql_query function with read_sql. Let's see what happens.
    – Mayank Porwal
    Nov 18 at 3:19










  • I tried that too..but I got the same error ..EVerything works fine conn object is created and it displays connections successful ..but as soon as I try to get data from table it does not work ....and I chcecked the tables variable ..it is a (0,5) size dataframe and it is all empty for more information ....Is there anything else that I can do?
    – PS1
    Nov 18 at 3:36










  • @MayankPorwal do you have any other ideas which might work?
    – PS1
    Nov 18 at 15:24















up vote
0
down vote

favorite












I am trying to connect to the sqllite3 database. But it says
DatabaseError: Execution failed on sql 'SELECT * FROM League': no such table: League



I have tried many ways to get through this.



import sqlite3
import os.path
import pandas as pd
import numpy as np
from matplotlib import pyplot as plt
from sklearn.cluster import KMeans
from sklearn.preprocessing import scale


#BASE_DIR = os.path.dirname(os.path.abspath(pat))
#database = os.path.join(BASE_DIR, "database.sqlite")

#with sqlite3.connect(database) as conn:
#
# print("Connection Successful",conn)
# df = pd.read_sql_query("SELECT * FROM Country", conn)

pat = r'C:UserspouruDownloadssoccer'
database = pat + 'database.sqlite'
conn = sqlite3.connect(database)
print("Connection Successful",conn)
df = pd.read_sql_query('SELECT * FROM League', conn)


It says connection successful but when I insert the last statement to get the table data, it produces the above error. I tried to solve it using the absolute path way like the code I have commented above but it gives the same error.



Can anyone give me an idea to solve this? I have tried with all the tables. It works well on the SQL interface but not in python.










share|improve this question






















  • Try replacing read_sql_query function with read_sql. Let's see what happens.
    – Mayank Porwal
    Nov 18 at 3:19










  • I tried that too..but I got the same error ..EVerything works fine conn object is created and it displays connections successful ..but as soon as I try to get data from table it does not work ....and I chcecked the tables variable ..it is a (0,5) size dataframe and it is all empty for more information ....Is there anything else that I can do?
    – PS1
    Nov 18 at 3:36










  • @MayankPorwal do you have any other ideas which might work?
    – PS1
    Nov 18 at 15:24













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I am trying to connect to the sqllite3 database. But it says
DatabaseError: Execution failed on sql 'SELECT * FROM League': no such table: League



I have tried many ways to get through this.



import sqlite3
import os.path
import pandas as pd
import numpy as np
from matplotlib import pyplot as plt
from sklearn.cluster import KMeans
from sklearn.preprocessing import scale


#BASE_DIR = os.path.dirname(os.path.abspath(pat))
#database = os.path.join(BASE_DIR, "database.sqlite")

#with sqlite3.connect(database) as conn:
#
# print("Connection Successful",conn)
# df = pd.read_sql_query("SELECT * FROM Country", conn)

pat = r'C:UserspouruDownloadssoccer'
database = pat + 'database.sqlite'
conn = sqlite3.connect(database)
print("Connection Successful",conn)
df = pd.read_sql_query('SELECT * FROM League', conn)


It says connection successful but when I insert the last statement to get the table data, it produces the above error. I tried to solve it using the absolute path way like the code I have commented above but it gives the same error.



Can anyone give me an idea to solve this? I have tried with all the tables. It works well on the SQL interface but not in python.










share|improve this question













I am trying to connect to the sqllite3 database. But it says
DatabaseError: Execution failed on sql 'SELECT * FROM League': no such table: League



I have tried many ways to get through this.



import sqlite3
import os.path
import pandas as pd
import numpy as np
from matplotlib import pyplot as plt
from sklearn.cluster import KMeans
from sklearn.preprocessing import scale


#BASE_DIR = os.path.dirname(os.path.abspath(pat))
#database = os.path.join(BASE_DIR, "database.sqlite")

#with sqlite3.connect(database) as conn:
#
# print("Connection Successful",conn)
# df = pd.read_sql_query("SELECT * FROM Country", conn)

pat = r'C:UserspouruDownloadssoccer'
database = pat + 'database.sqlite'
conn = sqlite3.connect(database)
print("Connection Successful",conn)
df = pd.read_sql_query('SELECT * FROM League', conn)


It says connection successful but when I insert the last statement to get the table data, it produces the above error. I tried to solve it using the absolute path way like the code I have commented above but it gives the same error.



Can anyone give me an idea to solve this? I have tried with all the tables. It works well on the SQL interface but not in python.







python pandas sqlite






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 18 at 3:10









PS1

31




31












  • Try replacing read_sql_query function with read_sql. Let's see what happens.
    – Mayank Porwal
    Nov 18 at 3:19










  • I tried that too..but I got the same error ..EVerything works fine conn object is created and it displays connections successful ..but as soon as I try to get data from table it does not work ....and I chcecked the tables variable ..it is a (0,5) size dataframe and it is all empty for more information ....Is there anything else that I can do?
    – PS1
    Nov 18 at 3:36










  • @MayankPorwal do you have any other ideas which might work?
    – PS1
    Nov 18 at 15:24


















  • Try replacing read_sql_query function with read_sql. Let's see what happens.
    – Mayank Porwal
    Nov 18 at 3:19










  • I tried that too..but I got the same error ..EVerything works fine conn object is created and it displays connections successful ..but as soon as I try to get data from table it does not work ....and I chcecked the tables variable ..it is a (0,5) size dataframe and it is all empty for more information ....Is there anything else that I can do?
    – PS1
    Nov 18 at 3:36










  • @MayankPorwal do you have any other ideas which might work?
    – PS1
    Nov 18 at 15:24
















Try replacing read_sql_query function with read_sql. Let's see what happens.
– Mayank Porwal
Nov 18 at 3:19




Try replacing read_sql_query function with read_sql. Let's see what happens.
– Mayank Porwal
Nov 18 at 3:19












I tried that too..but I got the same error ..EVerything works fine conn object is created and it displays connections successful ..but as soon as I try to get data from table it does not work ....and I chcecked the tables variable ..it is a (0,5) size dataframe and it is all empty for more information ....Is there anything else that I can do?
– PS1
Nov 18 at 3:36




I tried that too..but I got the same error ..EVerything works fine conn object is created and it displays connections successful ..but as soon as I try to get data from table it does not work ....and I chcecked the tables variable ..it is a (0,5) size dataframe and it is all empty for more information ....Is there anything else that I can do?
– PS1
Nov 18 at 3:36












@MayankPorwal do you have any other ideas which might work?
– PS1
Nov 18 at 15:24




@MayankPorwal do you have any other ideas which might work?
– PS1
Nov 18 at 15:24












1 Answer
1






active

oldest

votes

















up vote
0
down vote



accepted










change the pat = r'C:UserspouruDownloadssoccer' to



pat = 'C:UserspouruDownloadssoccer'





share|improve this answer





















  • Yeah I tried that and it didn't work with this as well and finally, I did this pat = 'C:\Users\pouru\Downloads\soccer\' and it works here. Thank you.
    – PS1
    Nov 19 at 19:39













Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53357551%2fdatabaseerror-execution-failed-on-sql-no-such-table-league%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote



accepted










change the pat = r'C:UserspouruDownloadssoccer' to



pat = 'C:UserspouruDownloadssoccer'





share|improve this answer





















  • Yeah I tried that and it didn't work with this as well and finally, I did this pat = 'C:\Users\pouru\Downloads\soccer\' and it works here. Thank you.
    – PS1
    Nov 19 at 19:39

















up vote
0
down vote



accepted










change the pat = r'C:UserspouruDownloadssoccer' to



pat = 'C:UserspouruDownloadssoccer'





share|improve this answer





















  • Yeah I tried that and it didn't work with this as well and finally, I did this pat = 'C:\Users\pouru\Downloads\soccer\' and it works here. Thank you.
    – PS1
    Nov 19 at 19:39















up vote
0
down vote



accepted







up vote
0
down vote



accepted






change the pat = r'C:UserspouruDownloadssoccer' to



pat = 'C:UserspouruDownloadssoccer'





share|improve this answer












change the pat = r'C:UserspouruDownloadssoccer' to



pat = 'C:UserspouruDownloadssoccer'






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 19 at 19:03









R. ghimire

16




16












  • Yeah I tried that and it didn't work with this as well and finally, I did this pat = 'C:\Users\pouru\Downloads\soccer\' and it works here. Thank you.
    – PS1
    Nov 19 at 19:39




















  • Yeah I tried that and it didn't work with this as well and finally, I did this pat = 'C:\Users\pouru\Downloads\soccer\' and it works here. Thank you.
    – PS1
    Nov 19 at 19:39


















Yeah I tried that and it didn't work with this as well and finally, I did this pat = 'C:\Users\pouru\Downloads\soccer\' and it works here. Thank you.
– PS1
Nov 19 at 19:39






Yeah I tried that and it didn't work with this as well and finally, I did this pat = 'C:\Users\pouru\Downloads\soccer\' and it works here. Thank you.
– PS1
Nov 19 at 19:39




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53357551%2fdatabaseerror-execution-failed-on-sql-no-such-table-league%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

"Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

Alcedinidae

RAC Tourist Trophy