Skip to main content

Peristent SQLite Database using S3 on Cloud Workspaces

Project description

Persistent SQLite Database on Cloud Workspaces

As a data science enthusiast, I have been using Lightning AI for my analytics and upskilling. It’s a great and cost-effective platform, but I’ve often faced one major limitation—the absence of SQL Server or any other persistent database.

This isn’t just a Lightning AI issue; it’s a common challenge with Google Colab, Codespaces, and other cloud workspaces. One common workaround is using SQLite, but there’s a catch—since cloud workspaces are ephemeral, all data is lost after every session, forcing me to recreate tables from scratch each time.

In Lightning AI, I could reuse the same database file within the same studio, but what if I wanted to access it across different studios? While there is a way around this, it’s neither easy nor straightforward.

Exploring Alternatives

I considered using AWS RDS or Azure Databases, but they are expensive and not ideal for someone using them for personal projects or learning.

The Solution: Persistent SQL Database for Cloud Workspaces

To address this, I built a python module 'persist-sql' that allows users to maintain a persistent SQL database in cloud environments using: ✅ SQLite Database for local queries ✅ AWS S3 Bucket for persistent storage

How to Use -

  1. pip install persistentsql
  2. import persistentsql as ps ps.configure_aws(AWS_KEY, AWS_SECRET, AWS_BUCKET_NAME) ps.connect_db('DEV') %sql select * from tablename ps.close_connection()

Limitations & Considerations

🔹 This works best when your database size is small. 🔹 If your data grows significantly, consider splitting tables across multiple database files to optimize performance.

GitHub Repository & Demo Notebook

I have shared sample notebook demonstrating how to use this solution. Feel free to explore, contribute, and share your feedback! 🚀

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

persistentsql-0.1.2.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

persistentsql-0.1.2-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file persistentsql-0.1.2.tar.gz.

File metadata

  • Download URL: persistentsql-0.1.2.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for persistentsql-0.1.2.tar.gz
Algorithm Hash digest
SHA256 0a5438b5ac60f7c0cf88d14400eb78e139c7fe9ff51576f77e8a13d800445442
MD5 d2516a9fc042abe0db4dee89c06c5d19
BLAKE2b-256 671f1bd23073b94b2cac4e99843a60aa12296854c94b7e8c6572850d9747b7c6

See more details on using hashes here.

File details

Details for the file persistentsql-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: persistentsql-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for persistentsql-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0710bfe09c9727169c9f73e3b29382604348e46e5a4ae5ac65ef8d801a3eeb05
MD5 357d93c469523a97670260e409a56b6b
BLAKE2b-256 7c8222a8e45096ebec1477728c7f46e3e9194c1303c0ce1ead56831d18c1c6d4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page