Access sqlite file

I am trying to access the production.sqlite data in the attached volume

flyctl ssh sftp get ./app/sqlite3:/mnt/namei/production.sqlite says file not found, but flyctl ssh sftp find ./app/sqlite3:/mnt/namei/production.sqlite locates the file. Is there any other approach to doing this?

or is there a sqlite variant for flyctl postgres connect

1 Like

I am experiencing the same issue, but have found a work-around.

The file is there:

$ flyctl -a xxxx ssh sftp find /usr/app/data
Update available 0.0.441 -> v0.0.442.
Run "flyctl version update" to upgrade.

but i saw same issue as you when using get, says file not found:

$ flyctl -a xxx ssh sftp get /usr/app/data/noco.db
Update available 0.0.441 -> v0.0.442.
Run "flyctl version update" to upgrade.
Error get: local file /usr/app/data/noco.db: open /usr/app/data/noco.db: no such file or directory

However shell works fine!

$ echo 'get /usr/app/data/noco.db' | flyctl -a xxx ssh sftp shell
get //usr/app/data/noco.db -> noco.db
wrote 4161536 bytes

Any chance someone from support can look into this? The issue is specific to ‘sftp get’.

I have the same issue. Also when I use shell it downloads the sqlite.db but it is empty. Any idea??

flyctl ssh sftp get /data/sqlite.db

get: local file /data/sqlite.db: open /data/sqlite.db: no such file or directory

Sorry for the very late reply. Let me take a look!

First can you try the following to make sure your sqlite.db is not empty?

% fly ssh console -a your-app-3823 -C 'ls -l /data/sqlite.db'
Connecting to fdaa:1:d8b0:a7b:124:55fa:1368:2... complete
-rwxr-xr-x 1 root root 147176 Sep 24  2020 /data/sqlite.db

Then you can use sftp to copy the file.

fly ssh sftp get -a throbbing-haze-3823 /data/sqlite.db sqlite.db

The way fly ssh sftp get handles its command line parameters is not really intuitive. I will take a look other Unix commands to figure out a better way.

Here is the fix.

The sqlite.db is not empty

but fly ssh sftp get -a smarthome4u-admin-staging /data/sqlite.db sqlite.db is empty

That’s really odd. I don’t have a SQLite file on my app, but copying works for me. Would it happen only for this file, or any files you have? What is your OS? Is your flyctl up-to-date?

I tried multiple files. It still same results. My flyctl version is 0.1.8

@drocks: If I may interject as a curious bystander, fly sftp get is supposed to print a line of the form “462848 bytes written to sqlite.db”, do you get that line (or any other output)?
Make sure you delete the local file between attempts, because if the file exists locally fly will refuse to overwrite it and print an error message.
Also, it might be useful to run ls -l sqlite.db locally to double-check that the file is empty.

(@kaz: The OS is macOS based on the screenshot.)

@tom93 @kaz Not sure why, but now the file download is working now. Something fixed on the fly side recently?

Thanks for all the helps

Glad it’s working! We didn’t do any though.