'pandas.io.sql.DatabaseError: Execution failed on sql '
I am doing some youtube analysis, I had a problem with Sqllite3. even tried with sqlalchemy , it is not working. Here my db:
path_to_sqlite_db = f'bael_youtube_extraction.db'
Here my dbconnection:
def conn_string(path_to_sqlite_db):
# create sqlite db
#engine = create_engine(path_to_sqlite_db)
#conn = engine.connect()
conn = sqlite3.connect(path_to_sqlite_db)
return conn
This my error: The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "youtube_analysis.py", line 202, in <module>
extract_and_export_data(path_to_sqlite_db, vid_cnt_query,
File "youtube_analysis.py", line 196, in extract_and_export_data
df = pd.read_sql(query, conn)
File "/home/suri/.local/lib/python3.8/site-packages/pandas/io/sql.py", line 566, in read_sql
return pandas_sql.read_query(
File "/home/suri/.local/lib/python3.8/site-packages/pandas/io/sql.py", line 2080, in read_query
cursor = self.execute(*args)
File "/home/suri/.local/lib/python3.8/site-packages/pandas/io/sql.py", line 2032, in execute
raise ex from exc
pandas.io.sql.DatabaseError: Execution failed on sql '
select 'video_was_live' as tag,SUM(video_was_live)video_count
from python_video_details
union
select 'tutorial_tag' as tag,SUM(tutorial_tag)video_count
from python_video_details
union
select 'learn_tag' as tag,SUM(learn_tag)video_count
from python_video_details
union
select 'beginners_tag' as tag,SUM(beginners_tag)video_count
from python_video_details
union
select 'data_tag' as tag,SUM(data_tag)video_count
from python_video_details
union
select 'course_tag' as tag,SUM(course_tag)video_count
from python_video_details
union
select 'django_tag' as tag,SUM(django_tag)video_count
from python_video_details
': no such column: django_tag
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
