All Projects → RamblingCookieMonster → Pssqlite

RamblingCookieMonster / Pssqlite

Licence: mit
PowerShell module to query SQLite databases

Programming Languages

powershell
5483 projects

Projects that are alternatives of or similar to Pssqlite

Iosdebugdatabase
make it easy to debug databases in iOS applications iOS debug database
Stars: ✭ 219 (+19.02%)
Mutual labels:  database, sqlite, sqlite-database
Squeal
A Swift wrapper for SQLite databases
Stars: ✭ 303 (+64.67%)
Mutual labels:  database, sqlite, sqlite-database
Avsqldebugger
A Simple Core Data Debugger that will look inside your apps DB
Stars: ✭ 30 (-83.7%)
Mutual labels:  database, sqlite, sqlite-database
Rxgrdb
Reactive extensions for SQLite
Stars: ✭ 176 (-4.35%)
Mutual labels:  database, sqlite
Directus
Open-Source Data Platform 🐰 — Directus wraps any SQL database with a real-time GraphQL+REST API and an intuitive app for non-technical users.
Stars: ✭ 13,190 (+7068.48%)
Mutual labels:  database, sqlite
Kangaroo
SQL client and admin tool for popular databases
Stars: ✭ 127 (-30.98%)
Mutual labels:  database, sqlite
Next
Directus is a real-time API and App dashboard for managing SQL database content. 🐰
Stars: ✭ 111 (-39.67%)
Mutual labels:  database, sqlite
Sql Fundamentals
👨‍🏫 Mike's SQL Fundamentals and Professional SQL Courses
Stars: ✭ 140 (-23.91%)
Mutual labels:  database, sqlite
Sandman2
Automatically generate a RESTful API service for your legacy database. No code required!
Stars: ✭ 1,765 (+859.24%)
Mutual labels:  database, sqlite-database
Sqlite Jdbc
SQLite JDBC Driver
Stars: ✭ 1,961 (+965.76%)
Mutual labels:  database, sqlite
Esp32 arduino sqlite3 lib
Sqlite3 Arduino library for ESP32
Stars: ✭ 167 (-9.24%)
Mutual labels:  database, sqlite
Myblog
python写的博客,支持3种数据库,现在挂在evilbinary.org
Stars: ✭ 121 (-34.24%)
Mutual labels:  database, sqlite
Sqift
Powerful Swift wrapper for SQLite
Stars: ✭ 119 (-35.33%)
Mutual labels:  database, sqlite
Goose
A database migration tool. Supports SQL migrations and Go functions.
Stars: ✭ 2,112 (+1047.83%)
Mutual labels:  database, sqlite
Bible Database
Bible databases as XML, JSON, SQL & SQLITE3 Database format for various languages. Developers can download it freely for their development works. Freely received, freely give.
Stars: ✭ 111 (-39.67%)
Mutual labels:  database, sqlite
Roomasset
A helper library to help using Room with existing pre-populated database [DEPRECATED].
Stars: ✭ 138 (-25%)
Mutual labels:  database, sqlite
Cachew
Transparent and persistent cache/serialization powered by type hints
Stars: ✭ 155 (-15.76%)
Mutual labels:  sqlite, sqlite-database
Nut
Advanced, Powerful and easy to use ORM for Qt
Stars: ✭ 181 (-1.63%)
Mutual labels:  database, sqlite
Linq2db
Linq to database provider.
Stars: ✭ 2,211 (+1101.63%)
Mutual labels:  database, sqlite
Sqlite3 Encryption
The easiest way to build SQLite3 with encryption support on Windows. Compilation of DLL, SLL or shell is now a matter of minutes
Stars: ✭ 102 (-44.57%)
Mutual labels:  database, sqlite

Build status

PSSQLite PowerShell Module

This is a PowerShell module for working with SQLite. It uses similar syntax to the Invoke-Sqlcmd2 function from Chad Miller et al.

This covers limited functionality; contributions to this function or additional functions would be welcome!

Caveats:

  • Minimal testing.
  • Today was my first time working with SQLite

Functionality

Create a SQLite database and table:

  • Create a SQLite database and table

Query a SQLite database, using parameters:

  • Query a SQLite database

Create a SQLite connection, use it for subsequent queries:

  • Create a SQLite connection, use it

Insert large quantities of data quickly with transactions (why?):

  • Insert large quantities of data quickly

Instructions

# One time setup
    # Download the repository
    # Unblock the zip
    # Extract the PSSQLite folder to a module path (e.g. $env:USERPROFILE\Documents\WindowsPowerShell\Modules\)

    #Simple alternative, if you have PowerShell 5, or the PowerShellGet module:
        Install-Module PSSQLite

# Import the module.
    Import-Module PSSQLite    #Alternatively, Import-Module \\Path\To\PSSQLite

# Get commands in the module
    Get-Command -Module PSSQLite

# Get help for a command
    Get-Help Invoke-SQLiteQuery -Full

# Create a database and a table
    $Query = "CREATE TABLE NAMES (fullname VARCHAR(20) PRIMARY KEY, surname TEXT, givenname TEXT, BirthDate DATETIME)"
    $DataSource = "C:\Names.SQLite"

    Invoke-SqliteQuery -Query $Query -DataSource $DataSource

# View table info
    Invoke-SqliteQuery -DataSource $DataSource -Query "PRAGMA table_info(NAMES)"

# Insert some data, use parameters for the fullname and birthdate
    $query = "INSERT INTO NAMES (fullname, surname, givenname, birthdate) VALUES (@full, 'Cookie', 'Monster', @BD)"

    Invoke-SqliteQuery -DataSource $DataSource -Query $query -SqlParameters @{
        full = "Cookie Monster"
        BD   = (get-date).addyears(-3)
    }

# View the data
    Invoke-SqliteQuery -DataSource $DataSource -Query "SELECT * FROM NAMES"

#Build up some fake data to bulk insert, convert it to a datatable
    $DataTable = 1..10000 | %{
        [pscustomobject]@{
            fullname = "Name $_"
            surname = "Name"
            givenname = "$_"
            BirthDate = (Get-Date).Adddays(-$_)
        }
    } | Out-DataTable

#Insert the data within a single transaction (SQLite is faster this way)
    Invoke-SQLiteBulkCopy -DataTable $DataTable -DataSource $DataSource -Table Names -NotifyAfter 1000 -verbose

#View all the data!
    Invoke-SqliteQuery -DataSource $DataSource -Query "SELECT * FROM NAMES"

Notes

This isn't a fully featured module or function.

I'm planning to write about using SQL from a systems administrator or engineer standpoint. I personally stick to MSSQL and Invoke-Sqlcmd2, but want to provide an abstracted means to perform this without the prerequisite of an accessible MSSQL instance.

Check out Jim Christopher's SQLite PowerShell Provider. It offers more functionality and flexibility than this repository.

Credit to Chad Miller, Justin Dearing, Paul Bryson, Joel Bennett, and Dave Wyatt for the code carried over from Invoke-Sqlcmd2.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].