0

I'm trying to join two tables using SQLite according to unique case id numbers.

If I try running this..

SELECT *
FROM collisions c 
INNER JOIN parties p ON c.case_id = p.case_id
WHERE date(collision_date) BETWEEN date('2020-01-01') and date('2021-12-31')

I get an error saying database/disk is full.

I manage to get by creating two databases based on unique ID number, as such..

query_two = """
SELECT * 
FROM parties 
WHERE date(case_id) BETWEEN '3982887' and '3984887'

"""

query = """
SELECT * 
FROM collisions 
WHERE date(case_id) BETWEEN '3982887' and '3984887'

"""


and merging them together like this

concat = pd.merge(df_one, df_two, on = 'case_id', how = 'inner')

But this gives me a random sample and it so happens that these case ids include collisions from 2007.

I want to be more specific and join only cases with a specific date range of 2020-01-01 to 2021-12-31.

Note: The parties table doesn't have collision_date - so the only way to join both tables is on case_id.

Is there a workaround to this?

Thanks!

Jean-Paul Azzopardi
  • 401
  • 1
  • 2
  • 10
  • fix the original problem , it might be due to corrupted database , see https://stackoverflow.com/questions/5274202/sqlite3-database-or-disk-is-full-the-database-disk-image-is-malformed – eshirvana Nov 23 '22 at 15:46

0 Answers0