question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Generate a sqlite3 db file?

See original GitHub issue
PRAGMA foreign_keys = false;

DROP TABLE IF EXISTS "app";
CREATE TABLE "app" (
  "id" INTEGER,
  "name" TEXT,
  "version" TEXT,
  "description" TEXT,
  "license" TEXT,
  "bucket_repo" TEXT
);

DROP TABLE IF EXISTS "bucket";
CREATE TABLE "bucket" (
  "score" real,
  "bucket_repo" TEXT NOT NULL,
  "apps" integer,
  "stars" integer,
  "forks" integer,
  "updated" text,
  PRIMARY KEY ("bucket_repo")
);

PRAGMA foreign_keys = true;

Maybe need add more table fields.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
zhoujin7commented, Jun 24, 2020
1reaction
rashil2000commented, Jan 10, 2021

Hi @zhoujin7 This is a very nice thing! However, while your database updates daily, your query client doesn’t seem to be up to date. I have created an issue for it in your repo zhoujin7/scoop-search#2 I created this simple PowerShell function that provides search functionality locally through the commandline, and uses (and updates itself) your SQLite database file.

param(
  [String]$Name,
  [String]$Description,
  [String]$Version,
  [String]$Bucket_Repo,
  [String]$Table = 'app',
  [Switch]$ForceUpdate = $false
)

$DBFile = 'D:\Data\Projects\Random\scoop_directory.db'

if ($Table -eq 'bucket') {
  if (!($Bucket_Repo)) {
    Write-Host "`nEnter bucket repository query.`n" -ForegroundColor Red
    return
  }
  $query = "SELECT bucket_repo,apps,updated,stars FROM bucket WHERE bucket_repo LIKE `"%$Bucket_Repo%`" ORDER BY apps DESC;"
} else {
  if (!($Name -or $Description)) {
    Write-Host "`nEnter at least one of name or description.`n" -ForegroundColor Red
    return
  }
  $query = "SELECT name,version,bucket_repo,description FROM app WHERE name LIKE `"%$Name%`" AND description LIKE `"%$Description%`" AND version LIKE `"%$Version%`" AND bucket_repo LIKE `"%$Bucket_Repo%`" ORDER BY version DESC;"
}

if (!(Test-Path $DBFile) -or ((Get-Date) - (Get-Item $DBFile).LastWriteTime).TotalHours -ge 24 -or $ForceUpdate) {
  Invoke-WebRequest 'https://raw.githubusercontent.com/zhoujin7/crawl-scoop-directory/master/scoop_directory.db' -UseBasicParsing -OutFile $DBFile
  Write-Host "`nUpdated database - $DBFile.`n" -ForegroundColor Green
}

return Invoke-SqliteQuery -Database $DBFile -Query $query

(Run Install-Module PSSQLite before using this.)

Read more comments on GitHub >

github_iconTop Results From Across the Web

SQLite - CREATE Database - Tutorialspoint
The above command will create a file testDB.db in the current directory. This file will be used as database by SQLite engine. If...
Read more >
SQLite In 5 Minutes Or Less
At a shell or DOS prompt, enter: "sqlite3 test.db". This will create a new database named "test.db". (You can use a different name...
Read more >
SQLite Database: How to Create, Open, Backup & Drop Files
SQLite create a database and populate it with tables from a file · Save the file to SQLite as “SQLiteTutorialsDB. · Open cmd.exe,...
Read more >
SQLite - Create a Database - Quackit Tutorials
So in other words, to create a new database in SQLite, simply enter sqlite3 followed by the name of the file that you...
Read more >
How to Create a Database Using SQLite - FutureLearn
To create a new database using DB Browser, simply click New Database to create a database for your data, give the database an...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found