How to download sqlite database from azure web app (linux)

Efraín Ayala Herrera 30 Reputation points
2023-04-13T18:38:35.2866667+00:00

Hi Our web app uses sqlite3 database, we can successfully add, modify, delete records using de the web app, but if we download the sqlite file using ftp we get the initial database that was deployed, it does not contain the changes made through the web app. We downloaded one file from folder Repository and other one from wwwroot/output.tar but both have the initial content. Where can we find de right file that includes all the changes made? Regards Efrain Ayala

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,934 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Erkan Sahin 840 Reputation points
    2023-04-13T19:04:43.85+00:00

    Hello Efrain, Based on your description, it sounds like there may be some confusion about where the SQLite database file is located and where the changes made through the web app are being stored. It's possible that the database file you're downloading via FTP is not the correct file, or that the changes made through the web app are not being saved to the database file you think they are. To locate the correct SQLite database file, you may want to check the configuration of your web app and see where it is set to save the database file. Once you have located the correct database file, you should be able to download it via FTP and see all the changes made through the web app. It's also possible that there is some caching going on that is preventing the changes from being immediately visible in the downloaded database file. You may want to try clearing any caches or reloading the web app before downloading the database file to ensure that all changes have been written to the database. I hope this helps! Let me know if you have any further questions or concerns.


  2. ajkuma 28,036 Reputation points Microsoft Employee Moderator
    2023-04-17T13:22:40.5+00:00

    @Efraín Ayala Herrera , Typically, the SQLite database file is stored in a temporary directory on the server and is not persisted across deployments or server restarts. Instead, a new database file is created each time your web app starts up. To download the current version of your SQLite database file, you can try the following steps:

    1. Open the Kudu console for your web app. You can access the Kudu console by going to https://.scm.azurewebsites.net.
    2. Navigate to the D:\home\data directory.
    3. Look for a file with a .db or .sqlite extension. This is your SQLite database file.
    4. Download the file to your local machine using the Kudu console's download feature.

    Alternatively, you can use a tool like Azure Storage Explorer to download the SQLite database file from your web app's storage account. To do this, you will need to find the storage account that is associated with your web app and locate the container that contains the database file.

    Once you have downloaded the SQLite database file, you should be able to see all the changes that were made through your web app.

    As mentioned in this doc - it's not recommended to use storage mounts for local databases (such as SQLite) or for any other applications and components that rely on file handles and locks.

    To persist the SQLite database file across deployments and server restarts, you can configure your web app to use a persistent storage solution such as Azure Storage or Azure SQL Database.

    Kindly let us know how it goes, I'll follow-up with you further.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.