{"id":50266276,"url":"https://github.com/atc2146/pysqlgui","last_synced_at":"2026-05-27T14:04:10.004Z","repository":{"id":56379760,"uuid":"271208394","full_name":"atc2146/pysqlgui","owner":"atc2146","description":"⚡ A lightweight package for interfacing with SQL in Python","archived":false,"fork":false,"pushed_at":"2020-11-11T08:15:30.000Z","size":103,"stargazers_count":1,"open_issues_count":4,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-22T14:34:58.167Z","etag":null,"topics":["database","dataframe","jupyter-notebook","pandas","python","sql","sqlite","sqlite3"],"latest_commit_sha":null,"homepage":"","language":"Python","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/atc2146.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-06-10T07:26:07.000Z","updated_at":"2020-12-24T18:39:00.000Z","dependencies_parsed_at":"2022-08-15T17:40:32.045Z","dependency_job_id":null,"html_url":"https://github.com/atc2146/pysqlgui","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/atc2146/pysqlgui","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atc2146%2Fpysqlgui","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atc2146%2Fpysqlgui/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atc2146%2Fpysqlgui/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atc2146%2Fpysqlgui/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/atc2146","download_url":"https://codeload.github.com/atc2146/pysqlgui/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atc2146%2Fpysqlgui/sbom","scorecard":{"id":214293,"data":{"date":"2025-08-11","repo":{"name":"github.com/atc2146/pysqlgui","commit":"c1f184ea19c9c2d6c6f8e2caedfc0a5be564e4c8"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Code-Review","score":0,"reason":"Found 0/29 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.txt:0","Info: FSF or OSI recognized license: MIT License: LICENSE.txt:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 2 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-17T01:22:40.161Z","repository_id":56379760,"created_at":"2025-08-17T01:22:40.161Z","updated_at":"2025-08-17T01:22:40.161Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33568862,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-27T02:00:06.184Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","dataframe","jupyter-notebook","pandas","python","sql","sqlite","sqlite3"],"created_at":"2026-05-27T14:04:07.203Z","updated_at":"2026-05-27T14:04:09.995Z","avatar_url":"https://github.com/atc2146.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# :zap: Pysqlgui\n[![GitHub license](https://img.shields.io/github/license/Naereen/StrapDown.js.svg)](https://github.com/atc2146/pysqlgui/blob/master/LICENSE.txt) [![Generic badge](https://img.shields.io/badge/made_with-python-blue.svg)](https://www.python.org/) [![Generic badge](https://img.shields.io/badge/open_source-awesome-success.svg)](https://github.com/atc2146)\u003cbr\u003e\n\n**Pysqlgui** is a *lightweight* package for interfacing with **SQL** in Python.  You can run SQL queries on Pandas DataFrames.\u003cbr\u003e\n\n## :books: Features\n\n  - Create in memory databases.\n  - Run **_any_** valid SQL query.\n  - Clean and **visually appealing** query results with column names.\n  - Import tables from **CSV files** or **[Pandas DataFrames](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.html)**.\n  - Easily **rename**, **create**, or **drop** tables without writing *long and complex* queries.\n  - Easily retrieve table information such as **column type**, **default values**, **null constraints**, and **key constraints**.\n  - Helpful **error messages**.\n  - And **more**.\n\n\n## :memo: Usage\n\nUsing Pysqlgui is **easy**.\u003cbr\u003e\n\n```python\nimport pysqlgui\n\n# Load a file and name the table\nstores = pysqlgui.Database(['customers.csv'], ['CUSTOMERS'])\n\n# Run a query\nstores.run_query('SELECT * FROM CUSTOMERS;')\n```\n\nIf you are running code in a `Jupyter Notebook`, the output will be a Pandas DataFrame.  Otherwise, call print on the line above to print out the query result.\n\n**_Note_**: you can pass other data formats or no data at all!  Refer to [detailed documentation](https://github.com/atc2146/pysqlgui#page_facing_up-detailed-documentation \"Detailed Documentation\") below.\n\n\n## :desktop_computer: Installation\n\nFrom **[PyPi](https://pypi.org/project/pysqlgui)**:\n\n```sh\n$ pip install pysqlgui\n```\n\nUpgrade to latest version 1.0.1 (Released June 14, 2020)\n```sh\n$ pip install pysqlgui --upgrade\n```\n\n\n## :book: Quick Guide\n\n[Instantiate a Database object](https://github.com/atc2146/pysqlgui#page_facing_up-detailed-documentation) and pass any data if you wish.\n\n```python\nyour_database_name = pysqlgui.Database()\n```\nThen call any of the methods below!\n\n\n| Method | Summary |\n| --------- | ------ |\n| `Database.run_query(query)` | [Run a SQL query.](https://github.com/atc2146/pysqlgui#run-a-sql-query) |\n| `Database.show(table_name)` | [Show the contents of a table.](https://github.com/atc2146/pysqlgui#show-table) |\n| `Database.info(table_name=None)` | [Summary information](https://github.com/atc2146/pysqlgui#summary-information-about-the-database) about the database. Pass a table name as an argument to get table information. |\n| `Database.create_table(table_name, column_data)` | [Create an empty table.](https://github.com/atc2146/pysqlgui#create-an-empty-table) |\n| `Database.add_table(data, table_names=None)` | [Add a table](https://github.com/atc2146/pysqlgui#add-a-table) to the database from a CSV file or Pandas DataFrame. |\n| `Database.insert_data(table_name, data)` | [Insert data into a table.](https://github.com/atc2146/pysqlgui#insert-data) |\n| `Database.drop_table(table_name)` | [Drop a table.](https://github.com/atc2146/pysqlgui#drop-a-table) |\n| `Database.rename_table(table_name, change_to)` | [Rename a table.](https://github.com/atc2146/pysqlgui#rename-a-table) |\n\n## :page_facing_up: Detailed Documentation\n\n\n#### Creating a database\n```python\npysqlgui.Database(data=None, table_names=None, name=None)\n```\n**Parameters**  \n* **data** : *list or dict*, default=None, Optional\n    * Can be a list (of filepaths to CSVs, or of Pandas DataFrames), or a dict where the key is the table name and the value is the filepath to the CSV or a Pandas DataFrame.\n* **table_names** : *list*, default=None, Optional\n    * List of names of the tables, must be provided if data is of type list.\n* **name** : *str*, default=None, Optional\n    * Name given to the database.\n\n```python\nimport pysqlgui as psg\nimport pandas as pd\n\n# empty database\ndb_example_1 = psg.Database()\n\n# from csv file via list notation\ndb_example_2 = psg.Database(['customers.csv'], ['CUSTOMERS'])\n\n# from csv file via dict notation\ndb_example_3 = psg.Database({'CUSTOMERS': 'customers.csv'})\n\n# from a Pandas DataFrame\ndf = pd.DataFrame({'name': ['John', 'Mary'], 'age': [32, 18]})\ndb_example_4 = psg.Database([df], ['USERS'])\n\n# from a combination\ndb_example_5 = psg.Database([df, 'customers.csv'], ['USERS', 'CUSTOMERS'])\ndb_example_6 = psg.Database({'CUSTOMERS': 'customers.csv', 'USERS': df})\n```\n\n---\n\n#### Run a SQL query\n```python\npysqlgui.Database.run_query(query)\n```\nRuns a SQL query.  \n\n**Parameters**\n* **query** : *str*\n    * A SQL query.  \n\n**Returns**\n* **Pandas DataFrame, or None**\n    * Returns a Pandas DataFrame if the query is of SELECT or PRAGMA type, None otherwise. Note, all valid SQL is allowed including CREATE, INSERT, DROP, etc.\n\n```python\nimport pysqlgui as psg\nimport pandas as pd\n\n# SELECT data\ndf = pd.DataFrame({'name': ['John', 'Mary'], 'age': [32, 18]})\nmy_db = psg.Database([df], ['USERS'])\nmy_db.run_query('SELECT * FROM USERS;')\n```\n\n---\n\n#### Show table\n```python\npysqlgui.Database.show(table_name)\n```\nShows the contents of a table. Equivalent to SELECT * FROM.    \n\n**Parameters**\n* **table_name** : *str*\n    * The table to show.  \n\n**Returns**\n* **Pandas DataFrame**\n    * Pandas DataFrame of the table contents.\n\n```python\nimport pysqlgui as psg\nimport pandas as pd\n\nmy_db = core_database.Database([pd.DataFrame([['tom', 10], ['bob', 15]], columns=['name', 'age'])],['USERS'])\nmy_db.show('USERS')\n\n```\n\n---\n\n#### Summary information about the database\n```python\npysqlgui.Database.info(table_name=None)\n```\nReturns summary information about the database or a table.  \n\n**Parameters**\n* **table_name** : *str*, default=None, Optional  \n    * The name of the table.  If a name is not provided, returns summary information about the database.  \n\n**Returns**\n* **Pandas DataFrame**\n    * Returns summary database or table information in a Pandas DataFrame.\n\n```python\nimport pysqlgui as psg\nimport pandas as pd\n\ndf = pd.DataFrame({'name': ['John', 'Mary'], 'age': [32, 18]})\nmy_db = psg.Database([df], ['USERS'])\n\nmy_db.info() # database info\nmy_db.info('USERS') # table info\n```\n\n---\n\n#### Create an empty table\n```python\npysqlgui.Database.create_table(table_name, column_data)\n```\nCreates an empty table in the database. See [SQLite Datatypes](https://www.sqlite.org/datatype3.html).    \n\n**Parameters**\n* **table_name** : *str*   \n    * The name of the table to be created.  \n\n* **column_data** : *dict*   \n    * Keys are the column names, and values are the type with any properties.  \n\n**Returns**\n* **None**\n\n```python\nimport pysqlgui as psg\nimport pandas as pd\n\nmy_db = psg.Database()\nmy_db.create_table('users',\n                    {'user_id': 'INTEGER',\n                    'first_name': 'TEXT',\n                    'join_date': 'DATE',\n                    'score': 'FLOAT'})\n\n# create tables with additional properties\nmy_db_2 = psg.Database()\nmy_db_2.create_table('users',\n                    {'user_id': 'INTEGER PRIMARY KEY AUTOINCREMENT',\n                    'first_name': 'TEXT',\n                    'join_date': 'DATE'})\nmy_db_2.create_table('articles',\n                    {'article_id': 'INTEGER PRIMARY KEY',\n                    'article_name': 'TEXT',\n                    'written_by': 'INTEGER REFERENCES users(user_id)'})\n\n```\n\n---\n\n#### Add a table\n```python\npysqlgui.Database.add_table(data, table_names=None)\n```\nAdds one or more Table objects to the current Database instance.  \n\n**Parameters**  \n* **data** : *list or dict*\n    * Can be a list (of filepaths to CSVs, or of Pandas DataFrames), or a dict where the key is the table name and the value is the filepath to the CSV or a Pandas DataFrame.\n* **table_names** : *list*, default=None, Optional\n    * List of names of the tables, must be provided if data is of type list.\n\n**Returns**\n* **None**\n\n```python\nimport pysqlgui as psg\nimport pandas as pd\n\nmy_db = psg.Database()\ndf = pd.DataFrame({'name': ['John', 'Mary'], 'age': [32, 18]})\nmy_db.add_table([df], ['USERS'])\n```\n---\n\n#### Insert data\n```python\npysqlgui.Database.insert_data(table_name, data)\n```\nInserts data into the table.  Highly recommended to add via Pandas DataFrame.\n\n**Parameters**  \n* **table_name** : *str*\n    * The name of the existing table to add data.\n* **data** : *Pandas DataFrame or dict*\n    * Pandas DataFrame with the corresponding columns.  Or a dict where keys are the column names, and values are the column value.\n\n**Returns**\n* **None**\n\n```python\nimport pysqlgui as psg\nimport pandas as pd\n\nmy_db = psg.Database([pd.DataFrame({'name': ['John', 'Mary'], 'age': [32, 18]})],\n                     ['USERS'])\n\nmy_db.insert_data('USERS', pd.DataFrame({'name': ['Bob', 'Simram'], 'age': [22, 5]}))\nmy_db.insert_data('USERS', {'name': 'Jordan', 'age': 23})\n\n```\n\n\n\n---\n\n#### Drop a table\n```python\npysqlgui.Database.drop_table(table_name)\n```\nDrops a table in the database.  \n\n**Parameters**  \n* **table_name** : *str*\n    * The name of the table to be dropped.\n\n**Returns**\n* **None**\n\n```python\nimport pysqlgui as psg\nimport pandas as pd\n\nmy_db = psg.Database([pd.DataFrame({'name': ['John', 'Mary'], 'age': [32, 18]})],\n                     ['USERS'],\n                     'MY_DB_NAME')\nmy_db.drop_table('USERS')\n```\n\n---\n\n#### Rename a table\n```python\npysqlgui.Database.rename_table(table_name, change_to)\n```\nRenames a table in the database.  \n\n**Parameters**  \n* **table_name** : *str*\n    * The name of the table to be renamed.\n* **change_to** : *str*\n    * The new name of the table.\n\n**Returns**\n* **None**\n\n```python\nimport pysqlgui as psg\nimport pandas as pd\n\nmy_db = psg.Database([pd.DataFrame({'name': ['John', 'Mary'], 'age': [32, 18]})],\n                     ['USERS'],\n                     'MY_DB_NAME')\nmy_db.rename_table('USERS', 'USERS_NEW_NAME')\n```\n\n---\n\n\n## :gear: Development\n\nPysqlgui is built on the [sqlite3](https://docs.python.org/3/library/sqlite3.html) standard library.  \n\nThe sqlite3 [Connection Object](https://docs.python.org/3/library/sqlite3.html#cursor-objects) and [Cursor Object](https://docs.python.org/3/library/sqlite3.html#cursor-objects) is available to you:\n\n```python\nDatabase.connection\nDatabase.cursor\n```\n\nYou can find sample data used for some of the examples [here](/examples).\n\n## :pencil2: Contributing\n\n* Raise an [issue](https://github.com/atc2146/pysqlgui/issues) if you encounter any bugs or would like any features.\n* Complete [function stubs](/pysqlgui/core_database.py).\n* Fix [issues](https://github.com/atc2146/pysqlgui/issues).\n* Write [tests](/tests). See [instructions](/tests/how-to-run-tests-instructions.txt) on how to run tests.\n\n**Clone the repo**\n\n```sh\n$ git clone https://github.com/atc2146/pysqlgui.git\n```\n\n## :copyright: License\n\n[MIT](LICENSE.txt) © 2020 Alex Chung\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatc2146%2Fpysqlgui","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fatc2146%2Fpysqlgui","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatc2146%2Fpysqlgui/lists"}