Skip to main content

Utility to generate ChatGPT prompts for SQL writing, offering table structure snapshots and sample row data from Postgres and sqlite databases.

Project description

ChatGPT Prompt for SQL Writing

Generate a prompt for writing SQL queries with LLMs like ChatGPT. Drop your database URL and table name into the script and it will generate a prompt for you to copy and paste into your favorite LLM.

What this does

  • Snapshot of Table Structure: Understand the columns, types, and organization of your table at a glance.
  • Sample Rows: Includes INSERT statements to describe the data in your table.

Usage

Usage: llm-sql-prompt [OPTIONS] DATABASE_URL [TABLE_NAME]

Options:
  --help  Show this message and exit.

Generate a prompt from a postgres database:

llm-sql-prompt postgresql://postgres:postgres@localhost:5555/database_name table_name | pbcopy
llm-sql-prompt $DATABASE_URL

TODO

Super basic script, needs a lot of work

  • pg support
  • one entrypoint
  • multiple tables
  • prompt tweaking
  • understand prompt size limits and sample records until one fits

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llm_sql_prompt-0.2.0.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

llm_sql_prompt-0.2.0-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file llm_sql_prompt-0.2.0.tar.gz.

File metadata

  • Download URL: llm_sql_prompt-0.2.0.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.11.7 Linux/6.2.0-1018-azure

File hashes

Hashes for llm_sql_prompt-0.2.0.tar.gz
Algorithm Hash digest
SHA256 f423e1304c66efad6cdd2e4eabece572b96bb0b06e2a4a97e90956e0708e49bc
MD5 95c8fe1750b0848bfcbca7b513607e28
BLAKE2b-256 e4bf8e0ce05f2b43065745a19f152c4477b72239ff1bab1b8d2c12acb3bd91ae

See more details on using hashes here.

File details

Details for the file llm_sql_prompt-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: llm_sql_prompt-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.11.7 Linux/6.2.0-1018-azure

File hashes

Hashes for llm_sql_prompt-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8661240b15eacf3044fea53f3b63a7574333fc9ee412e410ae6de279feedb941
MD5 ac229e61b935560a761a80c0b31ef573
BLAKE2b-256 dfba73f9a0fe352071ff9597a859beccd37ac8f98cdac69bca39e8f0ee1d2c91

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page