{"id":13599341,"url":"https://github.com/RamblingCookieMonster/PSSQLite","last_synced_at":"2025-04-10T12:32:22.467Z","repository":{"id":28700808,"uuid":"32221183","full_name":"RamblingCookieMonster/PSSQLite","owner":"RamblingCookieMonster","description":"PowerShell module to query SQLite databases","archived":false,"fork":false,"pushed_at":"2024-03-15T17:05:44.000Z","size":5883,"stargazers_count":327,"open_issues_count":13,"forks_count":67,"subscribers_count":19,"default_branch":"master","last_synced_at":"2025-04-05T16:09:42.347Z","etag":null,"topics":["database","powershell","powershell-modules","sqlite","sqlite-database"],"latest_commit_sha":null,"homepage":"http://ramblingcookiemonster.github.io/SQLite-and-PowerShell/","language":"PowerShell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RamblingCookieMonster.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["ramblingcookiemonster"]}},"created_at":"2015-03-14T16:33:14.000Z","updated_at":"2025-04-03T21:48:10.000Z","dependencies_parsed_at":"2024-11-07T00:34:23.972Z","dependency_job_id":null,"html_url":"https://github.com/RamblingCookieMonster/PSSQLite","commit_stats":{"total_commits":53,"total_committers":8,"mean_commits":6.625,"dds":"0.39622641509433965","last_synced_commit":"73a21cef604e8a72625369dd412a9b3af4086987"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RamblingCookieMonster%2FPSSQLite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RamblingCookieMonster%2FPSSQLite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RamblingCookieMonster%2FPSSQLite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RamblingCookieMonster%2FPSSQLite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RamblingCookieMonster","download_url":"https://codeload.github.com/RamblingCookieMonster/PSSQLite/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248217145,"owners_count":21066633,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["database","powershell","powershell-modules","sqlite","sqlite-database"],"created_at":"2024-08-01T17:01:02.526Z","updated_at":"2025-04-10T12:32:17.457Z","avatar_url":"https://github.com/RamblingCookieMonster.png","language":"PowerShell","readme":"[![Build status](https://ci.appveyor.com/api/projects/status/7pm5cjeoqx09i3co/branch/master?svg=true)](https://ci.appveyor.com/project/RamblingCookieMonster/pssqlite)\n\nPSSQLite PowerShell Module\n=============\n\nThis is a PowerShell module for working with SQLite.  It uses similar syntax to the [Invoke-Sqlcmd2](https://github.com/RamblingCookieMonster/PowerShell/blob/master/Invoke-Sqlcmd2.ps1) function from Chad Miller et al.\n\nThis covers limited functionality; contributions to this function or additional functions would be welcome!\n\nCaveats:\n* Minimal testing.\n* Today was my first time working with SQLite\n\n## Functionality\n\nCreate a SQLite database and table:\n  * ![Create a SQLite database and table](/Media/Create.png)\n\nQuery a SQLite database, using parameters:\n  * ![Query a SQLite database](/Media/Query.png)\n\nCreate a SQLite connection, use it for subsequent queries:\n  * ![Create a SQLite connection, use it](/Media/Connection.png)\n\nInsert large quantities of data quickly with transactions ([why?](http://www.sqlite.org/faq.html#q19)):\n  * ![Insert large quantities of data quickly](/Media/Transaction.png)\n\n## Instructions\n\n```powershell\n# One time setup\n    # Download the repository\n    # Unblock the zip\n    # Extract the PSSQLite folder to a module path (e.g. $env:USERPROFILE\\Documents\\WindowsPowerShell\\Modules\\)\n\n    #Simple alternative, if you have PowerShell 5, or the PowerShellGet module:\n        Install-Module PSSQLite\n\n# Import the module.\n    Import-Module PSSQLite    #Alternatively, Import-Module \\\\Path\\To\\PSSQLite\n\n# Get commands in the module\n    Get-Command -Module PSSQLite\n\n# Get help for a command\n    Get-Help Invoke-SQLiteQuery -Full\n\n# Create a database and a table\n    $Query = \"CREATE TABLE NAMES (fullname VARCHAR(20) PRIMARY KEY, surname TEXT, givenname TEXT, BirthDate DATETIME)\"\n    $DataSource = \"C:\\Names.SQLite\"\n\n    Invoke-SqliteQuery -Query $Query -DataSource $DataSource\n\n# View table info\n    Invoke-SqliteQuery -DataSource $DataSource -Query \"PRAGMA table_info(NAMES)\"\n\n# Insert some data, use parameters for the fullname and birthdate\n    $query = \"INSERT INTO NAMES (fullname, surname, givenname, birthdate) VALUES (@full, 'Cookie', 'Monster', @BD)\"\n\n    Invoke-SqliteQuery -DataSource $DataSource -Query $query -SqlParameters @{\n        full = \"Cookie Monster\"\n        BD   = (get-date).addyears(-3)\n    }\n\n# View the data\n    Invoke-SqliteQuery -DataSource $DataSource -Query \"SELECT * FROM NAMES\"\n\n#Build up some fake data to bulk insert, convert it to a datatable\n    $DataTable = 1..10000 | %{\n        [pscustomobject]@{\n            fullname = \"Name $_\"\n            surname = \"Name\"\n            givenname = \"$_\"\n            BirthDate = (Get-Date).Adddays(-$_)\n        }\n    } | Out-DataTable\n\n#Insert the data within a single transaction (SQLite is faster this way)\n    Invoke-SQLiteBulkCopy -DataTable $DataTable -DataSource $DataSource -Table Names -NotifyAfter 1000 -verbose\n\n#View all the data!\n    Invoke-SqliteQuery -DataSource $DataSource -Query \"SELECT * FROM NAMES\"\n```\n\n## Notes\n\nThis isn't a fully featured module or function.\n\nI'm planning to write about using SQL from a systems administrator or engineer standpoint.  I personally stick to [MSSQL and Invoke-Sqlcmd2](https://ramblingcookiemonster.wordpress.com/2014/03/12/sql-for-powershell-for-sql-newbies/), but want to provide an abstracted means to perform this without the prerequisite of an accessible MSSQL instance.\n\nCheck out Jim Christopher's [SQLite PowerShell Provider](https://psqlite.codeplex.com/).  It offers more functionality and flexibility than this repository.\n\nCredit to Chad Miller, Justin Dearing, Paul Bryson, Joel Bennett, and Dave Wyatt for the code carried over from Invoke-Sqlcmd2.\n","funding_links":["https://github.com/sponsors/ramblingcookiemonster"],"categories":["PowerShell"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRamblingCookieMonster%2FPSSQLite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FRamblingCookieMonster%2FPSSQLite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRamblingCookieMonster%2FPSSQLite/lists"}