SkillAgentSearch skills...

SQLSymphony

A simple and powerful ORM library in Python

Install / Use

/learn @alexeev-prog/SQLSymphony
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

SQLSymphony

<a id="readme-top"></a>

<div align="center"> <p align="center"> SQLSymphony: The elegant and powerful SQLite3 ORM for Python <br /> <a href="https://alexeev-prog.github.io/SQLSymphony/"><strong>Explore the docs »</strong></a> <br /> <br /> <a href="#-comparison-with-alternatives">Comparison with Alternatives</a> . <a href="#-why-choose-sqlsymphony">Why Choose SQLSymphony</a> · <a href="#-key-features">Key Features</a> · <a href="#-getting-started">Getting Started</a> · <a href="#-usage-examples">Basic Usage</a> · <a href="#-specifications">Specification</a> · <a href="https://alexeev-prog.github.io/SQLSymphony/">Documentation</a> · <a href="https://github.com/alexeev-prog/SQLSymphony/blob/main/LICENSE">License</a> </p> </div> <br> <p align="center"> <img src="https://img.shields.io/github/languages/top/alexeev-prog/SQLSymphony?style=for-the-badge"> <img src="https://img.shields.io/github/languages/count/alexeev-prog/SQLSymphony?style=for-the-badge"> <img src="https://img.shields.io/github/license/alexeev-prog/SQLSymphony?style=for-the-badge"> <img src="https://img.shields.io/github/stars/alexeev-prog/SQLSymphony?style=for-the-badge"> <img src="https://img.shields.io/github/issues/alexeev-prog/SQLSymphony?style=for-the-badge"> <img src="https://img.shields.io/github/last-commit/alexeev-prog/SQLSymphony?style=for-the-badge"> </p>

SQLSymphony: The elegant and powerful SQLite3 ORM for Python

[!CAUTION] At the moment, SQLSymphony is archived and not supported. I create new ORM library later.

SQLSymphony is a lightweight ✨, powerful 💪, and high-performance⚡️, Object-Relational Mapping (ORM) library for Python, designed to simplify the interaction with SQLite3 databases. It provides a Pythonic, object-oriented interface that allows developers to focus on their application's bussiness logic rather than the underlying database management.

<p align='center'>SQLSymphony ORM - powerful and simple ORM for python</p>

🌟 Comparison with Alternatives

| Feature | SqlSymphony | SQLAlchemy | Peewee | | -------------------------------- | ------------ | ---------- | ------- | | 💫 Simplicity | ✔️ | ✔️ | ✔️ | | 🚀 Performance | ✔️ | ❌ | ✔️ | | 🌐 Database Agnosticism | ❌ | ✔️ | ❌ | | 📚 Comprehensive Documentation | ✔️ | ✔️ | ✔️ | | 🔥 Active Development | ✔️ | ✔️ | ❌ | | 💻 Audit changes & reverts | ✔️ | ❌ | ❌ | | ⚡ ASYNC Support | COMING SOON | ✔️ (v2) | ❌ |

<p align="right">(<a href="#readme-top">back to top</a>)</p>

🤔 Why Choose SqlSymphony?

✨ Simplicity: SqlSymphony offers a straightforward and intuitive API for performing CRUD operations, filtering, sorting, and more, making it a breeze to work with databases in your Python projects.

💪 Flexibility: The library is designed to be database-agnostic, allowing you to switch between different SQLite3 implementations without modifying your codebase.

⚡️ Performance: SqlSymphony is optimized for performance, leveraging techniques like lazy loading and eager loading to minimize database queries and improve overall efficiency.

📚 Comprehensive Documentation: SqlSymphony comes with detailed documentation, including usage examples and API reference, to help you get started quickly and efficiently.

🔍 Maintainability: The codebase follows best practices in software engineering, including principles like SOLID, Clean Code, and modular design, ensuring the library is easy to extend and maintain.

🧪 Extensive Test Coverage: SqlSymphony is backed by a comprehensive test suite, ensuring the library's reliability and stability.

<p align="right">(<a href="#readme-top">back to top</a>)</p>

📚 Key Features

  • Intuitive API: Pythonic, object-oriented interface for interacting with SQLite3 databases.
  • Database Agnosticism: Seamlessly switch between different SQLite3 implementations.
  • Performance Optimization: Lazy loading, eager loading, and other techniques for efficient database queries.
  • Comprehensive Documentation: Detailed usage examples and API reference to help you get started.
  • Modular Design: Clean, maintainable codebase that follows best software engineering practices.
  • Extensive Test Coverage: Robust test suite to ensure the library's reliability and stability.
<p align="right">(<a href="#readme-top">back to top</a>)</p>

🚀 Getting Started

SQLSymphony is available on PyPI. Simply install the package into your project environment with PIP:

pip install sqlsymphony_orm

Once installed, you can start using the library in your Python projects. Check out the documentation for detailed usage examples and API reference.

<p align="right">(<a href="#readme-top">back to top</a>)</p>

💻 Usage Examples

Security.Hashing

A security module created for hash functions.

<details> <summary>PlainHasher</summary>
from sqlsymphony_orm.security.hashing import PlainHasher, HashAlgorithm

hasher = PlainHasher(HashAlgorithm.SHA512) # also: SHA256, SHA512, MD5, BLAKE2B, BLAKE2S

hash1 = hasher.hash('password')
hash2 = hasher.hash('pasword')

hasher.verify('password', hash1) # True
hasher.verify('password', hash2) # False
</details> <details> <summary>SaltedHasher</summary>
from sqlsymphony_orm.security.hashing import SaltedHasher, HashAlgorithm

hasher = SaltedHasher(HashAlgorithm.SHA512, salt='SALT') # also: SHA256, SHA512, MD5, BLAKE2B, BLAKE2S
hasher2 = SaltedHasher(HashAlgorithm.SHA512, salt='SALT2') # also: SHA256, SHA512, MD5, BLAKE2B, BLAKE2S

hash1 = hasher.hash('password')
hash2 = hasher2.hash('password')

hasher.verify('password', hash1) # True
hasher.verify('password', hash2) # False
</details>

Migrations from old model to new model

During migration, a migrations directory is created, where database backups are stored, as well as a file sqlsymphony_migrates.json, which stores information about migrations. If you want to restore the database, then call the revert_migration function with the index_key parameter (by default -1, that is, the last migration), it will take the name of the database backup from sqlsymphony_migrates.json and replace the current database with the backup one. The current database file is taken from Session.

<details> <summary>Migrate from old model to new model</summary>
from sqlsymphony_orm.datatypes.fields import IntegerField, RealField, TextField
from sqlsymphony_orm.models.session_models import SessionModel
from sqlsymphony_orm.models.session_models import SQLiteSession
from sqlsymphony_orm.queries import QueryBuilder
from sqlsymphony_orm.migrations.migrations_manager import SQLiteMigrationManager
from time import time

start = time()
session = SQLiteSession("example.db")


class User(SessionModel):
	__tablename__ = "Users"

	id = IntegerField(primary_key=True)
	name = TextField(null=False)
	cash = RealField(null=False, default=0.0)

	def __repr__(self):
		return f"<User {self.pk}>"


class User2(SessionModel):
	__tablename__ = "Users"

	id = IntegerField(primary_key=True)
	name = TextField(null=False)
	cash = RealField(null=False, default=0.0)
	password = TextField(default="password1234")

	def __repr__(self):
		return f"<User {self.pk}>"


class Comment(SessionModel):
	id = IntegerField(primary_key=True)
	name = TextField(null=False)
	user_id = IntegerField(null=False)


user = User(name="John")
user2 = User(name="Bob")
user3 = User(name="Ellie")
session.add(user)
session.commit()
session.add(user2)
session.commit()
session.add(user3)
session.commit()
session.delete(user3)
session.commit()
session.update(model=user2, name="Anna")
session.commit()

comment = Comment(name=user.name, user_id=user.pk)
session.add(comment)
session.commit()

print(
	session.filter(QueryBuilder().SELECT("*").FROM(User.table_name).WHERE(name="Anna"))
)
print(session.get_all())
print(session.get_all_by_model(User))
print(user.pk)

migrations_manager = SQLiteMigrationManager(session)
migrations_manager.migrate_from_model(User, User2, "Users", "UserAnd")

session.close()

end = time()

total = round(end - start, 2)

print(f"Execution time: {total}s")
</details> <details> <summary>Revert last migration (rollback database)</summary>
from sqlsymphony_orm.datatypes.fields import IntegerField, RealField, TextField
from sqlsymphony_orm.models.session_models import SessionModel
from sqlsymphony_orm.models.session_models import SQLiteSession
from sqlsymphony_orm.queries import QueryBuilder
from sqlsymphony_orm.migrations.migrations_manager import SQLiteMigrationManager
from time import time

start = time()
session = SQLiteSession("example.db")


class User(SessionModel):
	__tablename__ = "Users"

	id = IntegerField(primary_key=True)
	name = TextField(null=False)
	cash = RealField(null=False, default=0.0)

	def __repr__(self):
		return f"<User {self.pk}>"


class User2(SessionModel):
	__tablename__ = "Users"

	id = IntegerField(primary_key=True)
	name = TextField(null=False)
	cash = RealField(null=False, default=0.0)
	password = TextField(default="password1234")

	def __repr__(self):
		return f"<User {self.pk}>"


class Comment(SessionModel):
	id = IntegerField(primary_key=True)
	name = TextField(null=False)
	user_id = IntegerField(null=False)


user = User(name="John")
user2 = User(name="Bob")
user3 = User(name="Ellie")
session.add(user)
session.commit()
session.add(user2)
session.commit()
session.add(user3)
session.commit()
session.delete(user3)
session.commit()
session.update(model=user2, name="Anna")
session.commit()

comment = Comment(name=user.name, user_id=user.pk)
session.add(comment)
session.commit()

print(
	ses
View on GitHub
GitHub Stars10
CategoryData
Updated1mo ago
Forks0

Languages

Python

Security Score

90/100

Audited on Feb 28, 2026

No findings