Relative Content

Tag Archive for pythondatabasesqlite

How do I join 2 SQL tables in python based on their (non-unique) ID and closest values in years?

I am currently working on my thesis where I try to automate creating family trees. Right now I am trying to link birth certificates to their respective parents by looking through the marriage certificates and linking the names: if the names of both parents in the birth certificate are exactly the same as in the marriage certificate, I want to link them. However, there are multiple marriage certificates that contain the exact same names. So how I try to “solve” it is to find the marriage certificate that has the closest date to the birth certificate to reduce errors (I am working with 12 million birth and 5 million marriage certificates).

How to only get a value from a table?

I want to extract a specific value from a table and do some calculations with it and insert the solution into an other table. The calculation includes an user input.

.read Not Populating Database – SQLite3

I am trying to use LLMs on databases, and have been stuck on this step trying to fill in the database. .read doesn’t do anything, just returning the 3 dots. Also, .help asks “Enter SQL code and press enter”. I am completely stumped, any help would be greatly appreciated. I am working on VScode with a newly downloaded python library enter image description here

can’t get the column value. It simply outputs the same number as the column

import sqlite3 def request(): with sqlite3.connect(‘sqlite_db.db’) as sqlite_conn: sql_request = ‘SELECT t,80 FROM SS_SZT’ sql_cursor = sqlite_conn.execute(sql_request) res = sql_cursor.fetchall() for i in res: print(i) request() output: (12.0, 80) (8.0, 80) (4.0, 80) (2.0, 80) (1.0, 80) (0.5, 80) enter image description here It outputs the value of column t. I just don’t understand why […]