CSQLY - SQL with YAML
CSQLY is a simplified query language for multiple databases that allows you to write database queries in YAML format and execute them against different database engines.
Features
- Write database queries in easy-to-read YAML format
- Support for multiple database types:
- SQLite
- MySQL/MariaDB
- PostgreSQL
- Oracle
- Microsoft SQL Server
- Simplified query syntax with type safety
- Connection pooling and management
- Easily extensible architecture
- Command-line interface for quick queries
Installation
Package Manager Console
Install-Package CSQLY
.NET CLI
dotnet add package CSQLY
Basic Usage
using CSQLY.Core;
using CSQLY.Connectors;
// Create a database connection
var connector = DatabaseConnector.Create(DatabaseType.SQLite, "Data Source=mydb.sqlite");
// Execute a CSQLY query
var result = await connector.ExecuteQueryAsync(@"
select:
columns:
- name
- email
from: users
where:
active: true
");
// Process results
foreach (var row in result)
{
Console.WriteLine($"Name: {row["name"]}, Email: {row["email"]}");
}
Command-Line Interface
CSQLY also provides a command-line interface for quick queries:
# Install the CLI tool
dotnet tool install --global CSQLY.CLI
# Execute a query from a file
csqly -f query.yaml -c "Data Source=mydb.sqlite" -t sqlite
Documentation
For detailed documentation, see:
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
See CONTRIBUTING.md for detailed guidelines.
License
This project is licensed under the MIT License - see the LICENSE file for details.