.schema error?

Hello! I was trying to set up SQLite and was doing fine until my set up decided to stop showing tables for .schema and now i’m completely stuck. I have searched everything and I cant find the answer.

I type .schema and it returns nothing:
Screen Shot 2021-05-14 at 8.57.14 PM

What am I doing wrong? how do I fix this?

My first guess would be that the file you specified wasn’t found in your current working directory, so it is making a new database with that name in the current working directory instead. Double check the correct file already exists in your working directory and if not either change your working directory to the place this file is located or pass the correct file path instead.

I cant believe I struggled with this for the last 72 hours and you solved it on the spot. thank you so much. I never thought about it being in another directory (i’m super new to learning this)

1 Like

If you’re unfamiliar with the command line there’s always something to trip you but I recognise the query (for sqlite in particular) as one many others have had :slightly_smiling_face:. It would be nice if sqlite gave you a warning that it couldn’t find the file and would be temporarily making a new one or something, ah well.

Hi, Not sure if its appropriate for me to piggy back on this post but I am new here but am having the same issue as jin.codecademy. I do however have the file saved on my desktop but am still getting the same error. What can i do next? Here is a screenshot of the file download, maybe this is causing the issue? Thanks so much!

It’s been a while since I’ve worked with OSX so I’m a little rusty with what pops up and when. How are you trying to open this file (is that the output of a double click in finder or something)?

The original poster was using the terminal app and the sqlite3 program, you don’t really need a default program or anything, the basic sqlite just works as a command line interface in your shell.

I was also using the terminal and got the same error (see below). The directory I am working in is were the file is located so i don’t know what else it could be?

Are you 100% sure that file is in the same directory and it’s not empty or something odd like that?

Before running sqlite3 ... just list the contents of the working directory ls -lh would be useful since you can quickly see file sizes too and double check that “exact” filename exists and is not empty.

After that I’m not sure what to suggest. You could try viewing the file with something like the GUI sqlite DB-Browser instead just for a sanity check.

I just re-ran the same commands (i used ls before as well) but for some reason this time it worked?!?!

Thank you so much for your time, i really appreciate you taking the time to respond.

1 Like

I had the same issue with .schema and nothing displayed.

Think the issue with me (and at least one other in this thread) was simply down to the desktop folder (which syncs to icloud) hadn’t sync’d yet, and the command prompt is referencing the sync’d icloud desktop folder.

If it’s not working - literally sleep on it and try again later (when it’s had time to sync!)

Log into icloud and if you don’t see the folder you need in the desktop icloud drive, it won’t work yet.

Sounds right to me anyway!
(That would have saved about 2 hours of my life last night!)