{"id":42989549,"url":"https://github.com/domclick/pggraph","last_synced_at":"2026-01-31T02:35:09.556Z","repository":{"id":57452125,"uuid":"278315136","full_name":"domclick/pggraph","owner":"domclick","description":"Утилита для работы с зависимостями таблиц в PostgreSQL","archived":false,"fork":false,"pushed_at":"2024-08-15T01:45:08.000Z","size":95,"stargazers_count":10,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-09-25T12:57:45.269Z","etag":null,"topics":["postgresql","python","python3"],"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/domclick.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","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,"zenodo":null}},"created_at":"2020-07-09T09:01:49.000Z","updated_at":"2024-07-22T07:56:26.000Z","dependencies_parsed_at":"2025-04-13T03:37:34.744Z","dependency_job_id":"717b4da0-9787-444c-b843-cf2870dbf395","html_url":"https://github.com/domclick/pggraph","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/domclick/pggraph","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/domclick%2Fpggraph","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/domclick%2Fpggraph/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/domclick%2Fpggraph/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/domclick%2Fpggraph/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/domclick","download_url":"https://codeload.github.com/domclick/pggraph/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/domclick%2Fpggraph/sbom","scorecard":{"id":350378,"data":{"date":"2025-08-11","repo":{"name":"github.com/domclick/pggraph","commit":"616f6fb84c64362ebe85d1e6e946641d82f20688"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.8,"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":"Code-Review","score":0,"reason":"Found 0/28 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":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"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":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: containerImage not pinned by hash: Dockerfile:3: pin your Docker image by updating python:3.8-slim to python:3.8-slim@sha256:1d52838af602b4b5a831beb13a0e4d073280665ea7be7f69ce2382f29c5a613f","Warn: pipCommand not pinned by hash: Dockerfile:10","Warn: pipCommand not pinned by hash: Dockerfile:10","Info:   0 out of   1 containerImage dependencies pinned","Info:   0 out of   2 pipCommand dependencies pinned"],"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":"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.md:0","Info: FSF or OSI recognized license: MIT License: LICENSE.md: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"}}]},"last_synced_at":"2025-08-18T08:10:29.976Z","repository_id":57452125,"created_at":"2025-08-18T08:10:29.977Z","updated_at":"2025-08-18T08:10:29.977Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28927259,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-30T22:32:35.345Z","status":"online","status_checked_at":"2026-01-31T02:00:09.179Z","response_time":128,"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":["postgresql","python","python3"],"created_at":"2026-01-31T02:35:09.470Z","updated_at":"2026-01-31T02:35:09.545Z","avatar_url":"https://github.com/domclick.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PgGraph\n\n[![PyPI](https://img.shields.io/pypi/v/pggraph.svg)](https://pypi.org/project/pggraph/) ![3.6, 3.7, 3.8](https://img.shields.io/pypi/pyversions/pggraph.svg) [![License: MIT](https://img.shields.io/github/license/domclick/pggraph)](https://github.com/domclick/pggraph/blob/master/LICENSE.md)\n\nУтилита для работы с зависимостями таблиц в PostgreSQL\n\nОсновной функционал:\n- Рекурсивное удаление и архивация строк в таблице с указанными Primary Key\u003cbr\u003e\n*Под архивацией понимается перенос строк в архивную таблицу (например, из \"books\" в \"books_archive\")*\n- Поиск зависимостей для указанной таблицы (ссылающиеся таблицы и таблицы на которые ссылается данная)\n- Поиск ссылок на строки с указанными Primary Key данной таблицы\n\n## Установка\n```$ pip install pggraph```\n\n## Файл конфигурации config.ini\nДля работы утилиты нужно создать на локальной машине конфигурационный файл config.ini со следующим содержимым:\n```ini\n[db]\nhost = localhost\nport = 5432\nuser = postgres\npassword = postgres\ndbname = postgres\nschema = public                 ; Необязательный параметр, указано значение по умолчанию\n\n[archive]                       ; Данный раздел заполнять необязательно, ниже указаны значения по умолчанию\nis_debug = false                ; Запуск в режиме debug (удаление из таблицы происходить не будет) \nchunk_size = 1000               ; Кол-во строк, которое архивируется за 1 шаг\nmax_depth = 20                  ; Максимальная глубина рекурсии\nto_archive = true               ; Режим архивации (строки из таблицы \"a\" переносятся в таблицу \"a_%archive_suffix%\")\narchive_suffix = 'archive'      ; Суффикс архивной таблицы\n```\n\n## Структура\n- **core** - основной функционал\n    - **db** - функции и классы для работы с БД\n        - archiver.py - Archiver - класс с функционалом архивации таблиц\n        - build_references.py - построение графа зависимостей между таблицами \n    - **utils** - вспомогательные функции и классы\n    - api.py - PgGraphApi, основной класс для работы\n    - config.py - парсинг конфигурации\n  \n\n## Команды для запуска\nУтилиту можно запускать из консоли, также с ней можно работать из кода или интерактивных оболочек, вроде IPython/JupyterLab.\n\n### Запуск из консоли\n\n#### Параметры\nПозиционные аргументы:\n- action - требуемое действие: archive_table, get_table_references или get_rows_references\n\nИменованные аргументы:\n- --config_path - путь к конфиг-файлу\n- --table - таблица с которой нужно совершить действие\n- --ids - список id через запятую, пример - 1,2,3 (необязательный параметр) \n- --log_path - путь к папке для логов (необязательный параметр, по умолчанию - None)\n- --log_level - уровень логирования (необязательный параметр, по умолчанию - INFO) \n\n```shell script\n$ pggraph -h\nusage: pggraph action [-h] --table TABLE [--ids IDS] [--config_path CONFIG_PATH]\npositional arguments:\n  action        required action: archive_table, get_table_references, get_rows_references\n\noptional arguments:\n  -h, --help                    show this help message and exit\n  --table TABLE                 table name\n  --ids IDS                     primary key ids, separated by comma, e.g. 1,2,3\n  --config_path CONFIG_PATH     path to config.ini\n  --log_path LOG_PATH           path to log dir\n  --log_level LOG_LEVEL         log level (debug, info, error)\n```\n\n#### Примеры команд\n\nАрхивация таблицы\n```shell script\n$ pggraph archive_table --config_path config.hw.local.ini --table flights --ids 1,2,3\n2020-06-20 19:27:44 INFO: flights - START\n2020-06-20 19:27:44 INFO: flights - start archive_recursive 3 rows (depth=0)\n2020-06-20 19:27:44 INFO:       START ARCHIVE REFERRING TABLES\n2020-06-20 19:27:44 INFO:       ticket_flights - start archive_recursive 3 rows (depth=1)\n2020-06-20 19:27:44 INFO:               START ARCHIVE REFERRING TABLES\n2020-06-20 19:27:44 INFO:               boarding_passes - start archive_recursive 3 rows (depth=2)\n2020-06-20 19:27:44 INFO:                       START ARCHIVE REFERRING TABLES\n2020-06-20 19:27:44 INFO:                       END ARCHIVE REFERRING TABLES\n2020-06-20 19:27:44 INFO:               boarding_passes - archive_by_ids 3 rows by ticket_no, flight_id\n2020-06-20 19:27:44 INFO:               boarding_passes - start archive_recursive 3 rows (depth=2)\n2020-06-20 19:27:44 INFO:                       START ARCHIVE REFERRING TABLES\n2020-06-20 19:27:44 INFO:                       END ARCHIVE REFERRING TABLES\n2020-06-20 19:27:44 INFO:               boarding_passes - archive_by_ids 3 rows by ticket_no, flight_id\n2020-06-20 19:27:44 INFO:               boarding_passes - start archive_recursive 3 rows (depth=2)\n2020-06-20 19:27:44 INFO:                       START ARCHIVE REFERRING TABLES\n2020-06-20 19:27:44 INFO:                       END ARCHIVE REFERRING TABLES\n2020-06-20 19:27:44 INFO:               boarding_passes - archive_by_ids 3 rows by ticket_no, flight_id\n2020-06-20 19:27:44 INFO:               boarding_passes - start archive_recursive 3 rows (depth=2)\n2020-06-20 19:27:44 INFO:                       START ARCHIVE REFERRING TABLES\n2020-06-20 19:27:44 INFO:                       END ARCHIVE REFERRING TABLES\n2020-06-20 19:27:44 INFO:               boarding_passes - archive_by_ids 3 rows by ticket_no, flight_id\n2020-06-20 19:27:44 INFO:               END ARCHIVE REFERRING TABLES\n2020-06-20 19:27:44 INFO:       ticket_flights - archive_by_ids 3 rows by ticket_no, flight_id\n2020-06-20 19:27:44 INFO:       END ARCHIVE REFERRING TABLES\n2020-06-20 19:27:44 INFO: flights - archive_by_ids 3 rows by id\n2020-06-20 19:27:44 INFO: flights - END\n```\n\nПоиск зависимостей для указанной таблицы\n```shell script\n$ pggraph get_table_references --config_path config.hw.local.ini --table flights\n{'in_refs': {'ticket_flights': [ForeignKey(pk_main='flight_id', pk_ref='ticket_no, flight_id', fk_ref='flight_id')]},\n 'out_refs': {'aircrafts': [ForeignKey(pk_main='aircraft_code', pk_ref='flight_id', fk_ref='aircraft_code')],\n              'airports': [ForeignKey(pk_main='airport_code', pk_ref='flight_id', fk_ref='arrival_airport'),\n                           ForeignKey(pk_main='airport_code', pk_ref='flight_id', fk_ref='departure_airport')]}}\n```\n\nПоиск ссылок на строки с указанными Primary Key\n```shell script\n$ pggraph get_rows_references --config_path config.hw.local.ini --table flights --ids 1,2,3\n{1: {'ticket_flights': {'flight_id': [{'flight_id': 1,\n                                       'ticket_no': '0005432816945'},\n                                      {'flight_id': 1,\n                                       'ticket_no': '0005432816941'}]}},\n 2: {'ticket_flights': {'flight_id': [{'flight_id': 2,\n                                       'ticket_no': '0005433101832'},\n                                      {'flight_id': 2,\n                                       'ticket_no': '0005433101864'},\n                                      {'flight_id': 2,\n                                       'ticket_no': '0005432919715'}]}},\n 3: {'ticket_flights': {'flight_id': [{'flight_id': 3,\n                                       'ticket_no': '0005432817560'},\n                                      {'flight_id': 3,\n                                       'ticket_no': '0005432817568'},\n                                      {'flight_id': 3,\n                                       'ticket_no': '0005432817559'}]}}}\n```\n\n### Работа в интерактивной консоли iPython\nАрхивация таблицы\n```python\n\u003e\u003e\u003e from pggraph.main import setup_logging\n\u003e\u003e\u003e setup_logging(log_level='DEBUG')\n\u003e\u003e\u003e from pggraph.api import PgGraphApi\n\u003e\u003e\u003e api = PgGraphApi(config_path='config.hw.local.ini')\n\u003e\u003e\u003e api.archive_table('flights', [4,5])\n2020-06-20 23:12:08 INFO: flights - START\n2020-06-20 23:12:08 INFO: flights - start archive_recursive 2 rows (depth=0)\n2020-06-20 23:12:08 INFO: \tSTART ARCHIVE REFERRING TABLES\n2020-06-20 23:12:08 DEBUG: \tticket_flights - ForeignKey(pk_main='flight_id', pk_ref='flight_id, ticket_no', fk_ref='flight_id')\n2020-06-20 23:12:08 DEBUG: \tSQL('SELECT flight_id, ticket_no FROM bookings.ticket_flights WHERE (flight_id) IN (%s, %s)')\n2020-06-20 23:12:08 INFO: \tticket_flights - start archive_recursive 30 rows (depth=1)\n2020-06-20 23:12:08 INFO: \t\tSTART ARCHIVE REFERRING TABLES\n2020-06-20 23:12:08 DEBUG: \t\tboarding_passes - ForeignKey(pk_main='flight_id, ticket_no', pk_ref='flight_id, ticket_no', fk_ref='flight_id, ticket_no')\n2020-06-20 23:12:08 INFO: \t\tboarding_passes - archive_by_fk 30 rows by ForeignKey(pk_main='flight_id, ticket_no', pk_ref='flight_id, ticket_no', fk_ref='flight_id, ticket_no')\n2020-06-20 23:12:08 DEBUG: \t\tSQL('CREATE TABLE IF NOT EXISTS bookings.boarding_passes_archive (LIKE bookings.boarding_passes)')\n2020-06-20 23:12:08 DEBUG: \t\tDELETE FROM boarding_passes by FK flight_id, ticket_no - 30 rows\n2020-06-20 23:12:08 INFO: \t\tEND ARCHIVE REFERRING TABLES\n2020-06-20 23:12:08 INFO: \tticket_flights - archive_by_ids 30 rows by flight_id, ticket_no\n2020-06-20 23:12:08 DEBUG: \tSQL('CREATE TABLE IF NOT EXISTS bookings.ticket_flights_archive (LIKE bookings.ticket_flights)')\n2020-06-20 23:12:08 DEBUG: \tDELETE FROM ticket_flights by flight_id, ticket_no - 30 rows\n2020-06-20 23:12:08 DEBUG: \tINSERT INTO ticket_flights_archive - 30 rows\n2020-06-20 23:12:08 INFO: \tticket_flights - start archive_recursive 30 rows (depth=1)\n2020-06-20 23:12:08 INFO: \t\tSTART ARCHIVE REFERRING TABLES\n2020-06-20 23:12:08 DEBUG: \t\tboarding_passes - ForeignKey(pk_main='flight_id, ticket_no', pk_ref='flight_id, ticket_no', fk_ref='flight_id, ticket_no')\n2020-06-20 23:12:08 INFO: \t\tboarding_passes - archive_by_fk 30 rows by ForeignKey(pk_main='flight_id, ticket_no', pk_ref='flight_id, ticket_no', fk_ref='flight_id, ticket_no')\n2020-06-20 23:12:08 DEBUG: \t\tSQL('CREATE TABLE IF NOT EXISTS bookings.boarding_passes_archive (LIKE bookings.boarding_passes)')\n2020-06-20 23:12:08 DEBUG: \t\tDELETE FROM boarding_passes by FK flight_id, ticket_no - 30 rows\n2020-06-20 23:12:08 INFO: \t\tEND ARCHIVE REFERRING TABLES\n2020-06-20 23:12:08 INFO: \tticket_flights - archive_by_ids 30 rows by flight_id, ticket_no\n2020-06-20 23:12:08 DEBUG: \tSQL('CREATE TABLE IF NOT EXISTS bookings.ticket_flights_archive (LIKE bookings.ticket_flights)')\n2020-06-20 23:12:08 DEBUG: \tDELETE FROM ticket_flights by flight_id, ticket_no - 30 rows\n2020-06-20 23:12:08 DEBUG: \tINSERT INTO ticket_flights_archive - 30 rows\n2020-06-20 23:12:08 INFO: \tticket_flights - start archive_recursive 30 rows (depth=1)\n2020-06-20 23:12:08 INFO: \t\tSTART ARCHIVE REFERRING TABLES\n2020-06-20 23:12:08 DEBUG: \t\tboarding_passes - ForeignKey(pk_main='flight_id, ticket_no', pk_ref='flight_id, ticket_no', fk_ref='flight_id, ticket_no')\n2020-06-20 23:12:08 INFO: \t\tboarding_passes - archive_by_fk 30 rows by ForeignKey(pk_main='flight_id, ticket_no', pk_ref='flight_id, ticket_no', fk_ref='flight_id, ticket_no')\n2020-06-20 23:12:08 DEBUG: \t\tSQL('CREATE TABLE IF NOT EXISTS bookings.boarding_passes_archive (LIKE bookings.boarding_passes)')\n2020-06-20 23:12:08 DEBUG: \t\tDELETE FROM boarding_passes by FK flight_id, ticket_no - 30 rows\n2020-06-20 23:12:08 INFO: \t\tEND ARCHIVE REFERRING TABLES\n2020-06-20 23:12:08 INFO: \tticket_flights - archive_by_ids 30 rows by flight_id, ticket_no\n2020-06-20 23:12:08 DEBUG: \tSQL('CREATE TABLE IF NOT EXISTS bookings.ticket_flights_archive (LIKE bookings.ticket_flights)')\n2020-06-20 23:12:08 DEBUG: \tDELETE FROM ticket_flights by flight_id, ticket_no - 30 rows\n2020-06-20 23:12:08 DEBUG: \tINSERT INTO ticket_flights_archive - 30 rows\n2020-06-20 23:12:08 INFO: \tticket_flights - start archive_recursive 3 rows (depth=1)\n2020-06-20 23:12:08 INFO: \t\tSTART ARCHIVE REFERRING TABLES\n2020-06-20 23:12:08 DEBUG: \t\tboarding_passes - ForeignKey(pk_main='flight_id, ticket_no', pk_ref='flight_id, ticket_no', fk_ref='flight_id, ticket_no')\n2020-06-20 23:12:08 INFO: \t\tboarding_passes - archive_by_fk 3 rows by ForeignKey(pk_main='flight_id, ticket_no', pk_ref='flight_id, ticket_no', fk_ref='flight_id, ticket_no')\n2020-06-20 23:12:08 DEBUG: \t\tSQL('CREATE TABLE IF NOT EXISTS bookings.boarding_passes_archive (LIKE bookings.boarding_passes)')\n2020-06-20 23:12:08 DEBUG: \t\tDELETE FROM boarding_passes by FK flight_id, ticket_no - 3 rows\n2020-06-20 23:12:08 INFO: \t\tEND ARCHIVE REFERRING TABLES\n2020-06-20 23:12:08 INFO: \tticket_flights - archive_by_ids 3 rows by flight_id, ticket_no\n2020-06-20 23:12:08 DEBUG: \tSQL('CREATE TABLE IF NOT EXISTS bookings.ticket_flights_archive (LIKE bookings.ticket_flights)')\n2020-06-20 23:12:08 DEBUG: \tDELETE FROM ticket_flights by flight_id, ticket_no - 3 rows\n2020-06-20 23:12:08 DEBUG: \tINSERT INTO ticket_flights_archive - 3 rows\n2020-06-20 23:12:08 INFO: \tEND ARCHIVE REFERRING TABLES\n2020-06-20 23:12:08 INFO: flights - archive_by_ids 2 rows by flight_id\n2020-06-20 23:12:09 DEBUG: SQL('CREATE TABLE IF NOT EXISTS bookings.flights_archive (LIKE bookings.flights)')\n2020-06-20 23:12:09 DEBUG: DELETE FROM flights by flight_id - 2 rows\n2020-06-20 23:12:09 DEBUG: INSERT INTO flights_archive - 2 rows\n2020-06-20 23:12:09 INFO: flights - END\n```\n\nПоиск зависимостей для указанной таблицы\n```python\n\u003e\u003e\u003e from pggraph.api import PgGraphApi\n\u003e\u003e\u003e from pprint import pprint\n\u003e\u003e\u003e api = PgGraphApi(config_path='config.hw.local.ini')\n\u003e\u003e\u003e res = api.get_table_references('flights')\n\u003e\u003e\u003e pprint(res)\n{'in_refs': {'ticket_flights': [ForeignKey(pk_main='flight_id', pk_ref='flight_id, ticket_no', fk_ref='flight_id')]},\n 'out_refs': {'aircrafts': [ForeignKey(pk_main='aircraft_code', pk_ref='flight_id', fk_ref='aircraft_code')],\n              'airports': [ForeignKey(pk_main='airport_code', pk_ref='flight_id', fk_ref='arrival_airport'),\n                           ForeignKey(pk_main='airport_code', pk_ref='flight_id', fk_ref='departure_airport')]}}\n```\n\nПоиск ссылок на строки с указанными Primary Key\n```python\n\u003e\u003e\u003e from pggraph.api import PgGraphApi\n\u003e\u003e\u003e from pprint import pprint\n\u003e\u003e\u003e api = PgGraphApi(config_path='config.hw.local.ini')\n\u003e\u003e\u003e rows = api.get_rows_references('flights', [1,2,3])\n\u003e\u003e\u003e pprint(rows)\n{1: {'ticket_flights': {'flight_id': [{'flight_id': 1,\n                                       'ticket_no': '0005432816945'},\n                                      {'flight_id': 1,\n                                       'ticket_no': '0005432816941'}]}},\n 2: {'ticket_flights': {'flight_id': [{'flight_id': 2,\n                                       'ticket_no': '0005433101832'},\n                                      {'flight_id': 2,\n                                       'ticket_no': '0005433101864'},\n                                      {'flight_id': 2,\n                                       'ticket_no': '0005432919715'}]}},\n 3: {'ticket_flights': {'flight_id': [{'flight_id': 3,\n                                       'ticket_no': '0005432817560'},\n                                      {'flight_id': 3,\n                                       'ticket_no': '0005432817568'},\n                                      {'flight_id': 3,\n                                       'ticket_no': '0005432817559'}]}}}\n```\n\n## Author\n- [Borzov Oleg](https://github.com/olegborzov) (Author)\n\n## Contributor Notice\n\nWe are always open for contributions. Feel free to submit an issue\nor a PR. However, when submitting a PR we will ask you to sign\nour [CLA (Contributor License Agreement)][cla-text] to confirm that you\nhave the rights to submit your contributions and to give us the rights\nto actually use them.\n\nWhen submitting a PR our special bot will ask you to review and to sign\nour [CLA][cla-text]. This will happen only once for all our GitHub repositories.\n\n## License\n\nCopyright Ⓒ 2020 [\"Sberbank Real Estate Center\" Limited Liability Company](https://domclick.ru/).\n\n[MIT License](./LICENSE.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdomclick%2Fpggraph","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdomclick%2Fpggraph","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdomclick%2Fpggraph/lists"}