Questions tagged [sqlite]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
13 views

Retrieving image from SQLite, “Invalid or Unsupported Image Format”

I am getting an Invalid or Unsupported Image Format when I open an image stored and retrieved in SQLite. When I input the convertToBinaryData file into the writeTofile function then the photo is ...
0
votes
0answers
82 views

pset7/houses: db.execute(“INSERT”) fails to export data to students.db

I am using pandas to read in the csv file, since I'm familiar with dataframes from R. But I think that may not be the issue here, which is that db.execute fails to export data to students.db. The code,...
0
votes
1answer
20 views

problem with nesting sql queries in flask (final project)

I've been trying to only insert new ids if they weren't inserted before in my database but the problem I've been having is that I couldn't get the nested queries to work in python flask. Whatever I do ...
0
votes
1answer
54 views

pset7 Q7: How many actors are named “Meryl”?

I am at a complete loss for something that should be very simple to find in SQLite. In the IMDB database, I have to find how many actors have the name 'Meryl', I have tried select name, count(name) ...
0
votes
1answer
162 views

Pset 7 Movies - 13.sql “Error When Executing Query - Too Many Statements at Once”

I'm working on Pset 7 "Movies" and check50 shows an error for 13.sql (list of Kevin Bacon's co-stars) when I submit my code despite running successfully in the IDE. The exact error message is Error ...
0
votes
1answer
305 views

How to test pset7 queries in the terminal window?

I am trying to test the queries I've saved in files i.e. 1.sql, 2.sql,.... But I can't able to test them in the terminal window. The command given in the instruction is not showing any results. ...
1
vote
1answer
687 views

roster.py not getting output

import sys import cs50 # checking argv (that there's one and it's a csv) if (len(sys.argv) != 2): sys.exit("Usage: roster.py house_name") housename = sys.argv[1] #print(house_name) #open(f"...
0
votes
1answer
189 views

Pset8 Finance problems with SQLite inserting into a table

Inserting into a table in finance.db fails. I'm able to run the sqlite3 command via cli without errors and populate the table with the debugging snippet command: INSERT INTO history (date, symbol, ...
0
votes
1answer
282 views

Finance PSET8: Error: execute() takes 2 positional arguments but 3 were given

While implementing "Register" part in PSET8, I ran into the following problem - the code below returns: "TypeError: execute() takes 2 positional arguments but 3 were given". username = request.form....
0
votes
2answers
251 views

Pset 7 - create table (with foreign key) from command-line

For pset7 - finance I am trying to create a new table to keep track of buy transactions. Since I want this table to have a foreign key (referencing the 'id' in the 'users' table) and I understood that ...
0
votes
1answer
92 views

pset7 finance insert new row

I'm trying to add a row into my finance db using the code below (a few versions), but keeping getting an error saying I'm passing in too many variables to the execute() function. Any direction here ...
0
votes
2answers
439 views

Error Building SQLite Query Programmatically: TypeError: execute() takes 2 positional arguments but 3 were given

I'm trying to build a sqlite query programmatically by building a string that I pass to db.execute. query = "SELECT * FROM places WHERE postal_code LIKE :q" result = db.execute(query, q=q) This ...
2
votes
1answer
365 views

2017 pset8 mashup: Slow search - how to improve search performance?

I have successfully implemented search in application.py. Though ss I was testing through the app, I noticed that every search was really slow. It's turns out that every search request was from 63KB ...
0
votes
1answer
110 views

Importing to sqlite for final project

I'm having problems importing a file into an sqlite database for my final project. I have a .csv file which I want to import. I've created the table using the phplite GUI, with 14 fields (columns). ...
0
votes
1answer
538 views

How to insert data from a txt file to specific SQLite table column

I am trying to make the search function in mashup more versatile by creating a new column in my SQLite places table called full_location where it will hold the postal_code, place_name, and admin_name1 ...
0
votes
1answer
100 views

db.execute() executing only single time

When I enter amount, name, expinc in my html form it works for the first time, i.e. the entered data goes into database tables for the first time but whenever I try to enter data again it doesn't ...
0
votes
0answers
22 views

CS50's PHPLIteAdmin [duplicate]

I am currently working on my final project, and I need to create a database which contains a table with a FOREIGN KEY field. Unfortunately, I've constantly been getting errors. Upon Googling them, I ...
0
votes
1answer
476 views

sqlite multiplying two columns

I'm trying to have sqlite automatically do the calculation below for each column. I used the following line but not getting the intended result[see picture] Any help is appreciated. SELECT ...
0
votes
1answer
107 views

RunTimeError in buy() c$50 finance

why I get this error RuntimeError: (sqlite3.OperationalError) near "'$59.31'": syntax error [SQL: "INSERT INTO portfolio (id, symbol, shares, price) VALUES(2, 'A', 1, '$59.31'"] here is my code: @...
0
votes
0answers
92 views

Pset8 no such column: postal_code

I am trying to perform simple search in mashup.db database db.execute( "SELECT * FROM places WHERE postal_code = :q",q=request.args.get("q")) However I am getting RuntimeError: (sqlite3....
1
vote
1answer
343 views

`RuntimeError: no such column: user_id` pset7 [buy]

I'm having issues with buy. Initially, I was getting a RuntimeError: no such column: user_id At the time, I had the first code as below. After making changes, I now get RuntimeError: Bind parameter '...
1
vote
1answer
428 views

Challenge inserting into database from buy()

I'm have a challenge inserting into the database when I buy shares. I've made life a little complicated (or sophisticated!) because I decided to insert a separate step in the buying process: I start ...
1
vote
1answer
44 views

Problem set 7 insert statement fails - RuntimeError: 'str' object has no attribute 'key'

I searched through the cs50, but found no solutions for my problem: passwrd = pwd_context.encrypt(request.form.get("password")) db.execute("INSERT INTO users (username, hash, cash) VALUES (:...
0
votes
1answer
563 views

Finance: Update SQL Data: db.execute

Trying to add functionality to modify number of shares. This won't work: num_sell = request.form["num_sell"] db.execute("UPDATE purchases SET shares=num_sell WHERE order_num=1") "RuntimeError: (...
0
votes
2answers
74 views

CS50 Pset7: Final Questions before Wrap-Up

I am finally done with implementing my stock-trading website. Anyhow, I have some last questions before wrapping up and hope that someone can help me out to make sure I understand everything in this ...
0
votes
1answer
1k views

Pset7 buy - RuntimeError sqlite3.OperationalError near transaction

I have been working on pset7, and I have been getting this error when trying to buy via the html form: RuntimeError: (sqlite3.OperationalError) near "transaction": syntax error [SQL: "INSERT INTO ...
0
votes
1answer
50 views

How to use multiple “WHERE” while updating table in sqlite

In sqlite 3 I want to use two "WHERE" statements, here is my code right now "db.execute("UPDATE portfolio SET shares = :shares WHERE id = :ide",shares = symb[0]["shares"] - number,ide = ide)" I want ...
0
votes
1answer
246 views

How to represent current date and time of purchase in table

I need to know how to represent the date and time of purchase correctly in my table for storing who bought what at what price and when (as per the specs for buy). I tried to use datetime.datetime.now(...
0
votes
1answer
198 views

SQL search multiple columns with priority

I'm trying to implement the search in pset8 and want to find the most elegant and fast solution. The way I have implemented it is to first of all check whether the search term is an int, and if so, ...
0
votes
0answers
101 views

How to check if an SQL table exists without relying on errors?

pset7 help pls. Trying to check if a table exists. I am getting the error "information_schema.tables does not exist". I guess information_schema is not there in our SQL version? How else could I ...
1
vote
2answers
1k views

Set foreign key in phpLiteAdmin

Does anyone know how to set a foreign key using the phpLiteAdmin interface? The docs for this application are lacking, and the recommended syntax for adding a column using SQLite does not appear to ...