DbShell

OpenSource database automation toolkit

User Tools

Site Tools


start

Home

DbShell is free and opensource toolkit for automation of database operations. It is licensed under LGPL license. The list of supported contains MS SQL Server, SQLite, MySQL, PostgreSQL

DbShell can be used in two different ways:

  • From C# code as .NET library
  • As scripting language for database operations
    • Using DbShell Script syntax (preffered when script is writted by hand)
    • Using JSON syntax (preffered if input from DbShell is generated from other tools)
  • Obsolete: in the past DbShell used the XAML syntax (still supported in DbMouse)

DbShell Script example

This very simple example exports data of table Album into CSV file. This example uses DbShell Script notation.

SetConnection("sqlserver://Data Source=localhost\SQLEXPRESS;Integrated Security=SSPI;Initial Catalog=Chinook");

CopyTable(
    source = Table("album"),
    target = File("album.csv")
)

Usage in C# as library

DbShell is available as collection of NuGet packages (all functionality is contained in package DbShell.All ) . DbShell uses .NET Standard 2.0 - therefore is usable in .NET 4.6.1 and later or .NET Core 2.0 and later.

The same task implemented in C# will look like:

var copy = new CopyTable
{
    Connection = "sqlserver://Data Source=localhost\\SQLEXPRESS;Integrated Security=SSPI;Initial Catalog=Chinook",
    Source = new Table { Name = "album" },
    Target = new File { Name = "album.csv" },
};
 
copy.Run();
start.txt · Last modified: 2018/04/23 14:21 by admin