{"id":17603083,"url":"https://github.com/yjg30737/pyqt-database-example","last_synced_at":"2025-04-13T09:21:00.211Z","repository":{"id":54334644,"uuid":"511723031","full_name":"yjg30737/pyqt-database-example","owner":"yjg30737","description":"PyQt database (mainly SQLite) basic use example","archived":false,"fork":false,"pushed_at":"2024-03-21T03:00:09.000Z","size":64,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-27T00:54:55.659Z","etag":null,"topics":["database","database-gui","pyqt","pyqt5","pyside","pyside6","python","qsortfilterproxymodel","qsqldatabase","qsqlquery","qsqltablemodel","qt","qt-database","qtsql","sqlite"],"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/yjg30737.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"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}},"created_at":"2022-07-08T01:22:17.000Z","updated_at":"2024-11-19T00:05:44.000Z","dependencies_parsed_at":"2024-10-22T20:11:14.091Z","dependency_job_id":null,"html_url":"https://github.com/yjg30737/pyqt-database-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yjg30737%2Fpyqt-database-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yjg30737%2Fpyqt-database-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yjg30737%2Fpyqt-database-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yjg30737%2Fpyqt-database-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yjg30737","download_url":"https://codeload.github.com/yjg30737/pyqt-database-example/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248689277,"owners_count":21145903,"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","database-gui","pyqt","pyqt5","pyside","pyside6","python","qsortfilterproxymodel","qsqldatabase","qsqlquery","qsqltablemodel","qt","qt-database","qtsql","sqlite"],"created_at":"2024-10-22T13:39:23.011Z","updated_at":"2025-04-13T09:21:00.191Z","avatar_url":"https://github.com/yjg30737.png","language":"Python","readme":"# pyqt-database-example\nPyQt database (SQLite) basic use example\n\nI've stopped updating this, see \"See Also\" below and check the pyside-database-chart-example. I'm currently working on that one instead of this.\n\nBut you can still look through this and help yourself as well. This works like a charm.\n\n## Requirements\n* PyQt5 \u003e= 5.12\n\nBecause one of QSortFilterProxyModel's function(setFilterRegularExpression) requires at least 5.12. This is indeed very convinient function so you don't have to worry.\n\nAlso you can use this in PyQt6 or PySide6, if you change all of \"import PyQt5\" in whole repo.\n\n## Setup\n`python -m pip install git+https://github.com/yjg30737/pyqt-database-example.git --upgrade`\n\n## Feature\n* Add/delete record (one record at a time)\n* Search the text by each column\n* Set by ascending/descending order (ascending order by default)\n\n## Example\nCode Sample\n```python\nfrom PyQt5.QtWidgets import QApplication\nfrom pyqt_database_example import createConnection, initTable, addSample, QtDatabaseExample\n\nif __name__ == \"__main__\":\n    import sys\n\n    app = QApplication(sys.argv)\n    if not createConnection():\n        sys.exit(1)\n    initTable() # Create table. After create table, you don't need to do it unless you want to make the table to empty.\n    # addSample() Add sample records (Joe, Lara, David, Jane. See result image below.)\n    ex = QtDatabaseExample()\n    ex.show()\n    sys.exit(app.exec_())\n```\n\n![image](https://user-images.githubusercontent.com/55078043/177900006-31577341-84f3-4d87-bfff-36765fc3334c.png)\n\nIf you execute the script, \"contacts.sqlite\" SQLite database file will be made.\n\nResult\n\n\n![image](https://user-images.githubusercontent.com/55078043/183241774-786ad283-2461-4ef7-8b7e-f3c27c25ae92.png)\n\n'contacts' is table's name.\n\nYou can search the text with search bar. (instant search)\n\nYou can also set the column to search with combobox which is placed right next to search bar.\n\nAdd button literally adds new empty record.\n\nDelete button deletes selected row. (Only one row can be selected currently)\n\n### Search bar example\n\nLet's set the column to search as \"Name\" and search the text \"Dav\".\n\n![image](https://user-images.githubusercontent.com/55078043/183241795-5cb1a0cc-a551-4f0e-add7-f01ae7e7085e.png)\n\n## See Also\n\n* \u003ca href=\"https://github.com/yjg30737/pyside-database-chart-example/blob/main/README.md\"\u003epyside-database-chart-example\u003c/a\u003e - PySide6 version of this (+chart)\n* \u003ca href=\"https://realpython.com/python-pyqt-database/#reader-comments\"\u003eHandling SQL Databases With PyQt: The Basics\u003c/a\u003e - I made this thanks to this article.\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyjg30737%2Fpyqt-database-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyjg30737%2Fpyqt-database-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyjg30737%2Fpyqt-database-example/lists"}