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.0.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.0-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: persistentsql-0.1.0.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.0.tar.gz
Algorithm Hash digest
SHA256 dc361574c88139071539a8eed8569e1606e973d9d912adcb0d5f1b917a823d99
MD5 232076f803ebadd01a59e99745ce3974
BLAKE2b-256 2480017105fe2a28e0f6e80c4d01079f3d49731f2c5bf4b553779458d7504814

See more details on using hashes here.

File details

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

File metadata

  • Download URL: persistentsql-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.4 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d32ef68cf00a708d6595d29bc512a538c97065fa695a31cd531e65cf7a8d6e4a
MD5 e15bc23a12b54d3d4304d878d16d542a
BLAKE2b-256 6e270a96d75ab2730ae5185bbdc22d02022d3b890330c4692d380d947817e06f

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