Commit ae88816
postgres: collect relkind in schema metadata (DataDog#23888)
* postgres: collect relkind (incl views/matviews) in schema metadata
- Add c.relkind to PG_TABLES_QUERY_V10_PLUS and PG_TABLES_QUERY_V9 SELECT lists
- Expand relkind filter to include views ('v') and materialized views ('m')
- Propagate relkind through get_rows_query() schema_tables CTE, final SELECT, and GROUP BY
- Add relkind: str to TableObject TypedDict
- Add relkind to _map_row() per-table payload
- Add CREATE VIEW and CREATE MATERIALIZED VIEW to test database setup SQL
- Update test assertions to verify relkind is present and correct
- Update schema snapshot fixtures: add relkind to all existing tables, add
persons_view and persons_matview entries (fixtures need regeneration in CI
with actual OIDs via test_collect_schema_snapshot auto-update)
Environment: Datadog workspace
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Maciej Obuchowski <mobuchowski@datadoghq.com>
* remove pulling (materialized) views
Signed-off-by: Maciej Obuchowski <maciej.obuchowski@datadoghq.com>
* changelog entry
Signed-off-by: Maciej Obuchowski <maciej.obuchowski@datadoghq.com>
* Tighten relkind assertion to match collector query policy
The collector query in schemas.py only returns relkind values 'r', 'p',
and 'f' (regular tables, partitioned tables, foreign tables). Tighten
the test assertion to match, removing 'v' and 'm' which were included
when views/matviews were considered but then removed.
Environment: Datadog workspace
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Maciej Obuchowski <maciej.obuchowski@datadoghq.com>
---------
Signed-off-by: Maciej Obuchowski <mobuchowski@datadoghq.com>
Signed-off-by: Maciej Obuchowski <maciej.obuchowski@datadoghq.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent 860ccb2 commit ae88816
22 files changed
Lines changed: 868 additions & 431 deletions
File tree
- postgres
- changelog.d
- datadog_checks/postgres
- tests
- fixtures
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
| |||
54 | 55 | | |
55 | 56 | | |
56 | 57 | | |
| 58 | + | |
57 | 59 | | |
58 | 60 | | |
59 | 61 | | |
| |||
138 | 140 | | |
139 | 141 | | |
140 | 142 | | |
| 143 | + | |
141 | 144 | | |
142 | 145 | | |
143 | 146 | | |
| |||
315 | 318 | | |
316 | 319 | | |
317 | 320 | | |
318 | | - | |
| 321 | + | |
319 | 322 | | |
320 | 323 | | |
321 | 324 | | |
| |||
333 | 336 | | |
334 | 337 | | |
335 | 338 | | |
336 | | - | |
| 339 | + | |
| 340 | + | |
337 | 341 | | |
338 | 342 | | |
339 | 343 | | |
| |||
345 | 349 | | |
346 | 350 | | |
347 | 351 | | |
348 | | - | |
| 352 | + | |
| 353 | + | |
349 | 354 | | |
350 | 355 | | |
351 | 356 | | |
| |||
382 | 387 | | |
383 | 388 | | |
384 | 389 | | |
| 390 | + | |
385 | 391 | | |
386 | 392 | | |
387 | 393 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
| 56 | + | |
| 57 | + | |
57 | 58 | | |
58 | 59 | | |
59 | 60 | | |
| |||
113 | 114 | | |
114 | 115 | | |
115 | 116 | | |
116 | | - | |
| 117 | + | |
| 118 | + | |
117 | 119 | | |
118 | 120 | | |
119 | 121 | | |
| |||
167 | 169 | | |
168 | 170 | | |
169 | 171 | | |
170 | | - | |
| 172 | + | |
| 173 | + | |
171 | 174 | | |
172 | 175 | | |
173 | 176 | | |
| |||
227 | 230 | | |
228 | 231 | | |
229 | 232 | | |
230 | | - | |
| 233 | + | |
| 234 | + | |
231 | 235 | | |
232 | 236 | | |
233 | 237 | | |
| |||
287 | 291 | | |
288 | 292 | | |
289 | 293 | | |
290 | | - | |
| 294 | + | |
| 295 | + | |
291 | 296 | | |
292 | 297 | | |
293 | 298 | | |
| |||
362 | 367 | | |
363 | 368 | | |
364 | 369 | | |
365 | | - | |
| 370 | + | |
| 371 | + | |
366 | 372 | | |
367 | 373 | | |
368 | 374 | | |
| |||
422 | 428 | | |
423 | 429 | | |
424 | 430 | | |
425 | | - | |
| 431 | + | |
| 432 | + | |
426 | 433 | | |
427 | 434 | | |
428 | 435 | | |
| |||
482 | 489 | | |
483 | 490 | | |
484 | 491 | | |
485 | | - | |
| 492 | + | |
| 493 | + | |
486 | 494 | | |
487 | 495 | | |
488 | 496 | | |
| |||
542 | 550 | | |
543 | 551 | | |
544 | 552 | | |
545 | | - | |
| 553 | + | |
| 554 | + | |
546 | 555 | | |
547 | 556 | | |
548 | 557 | | |
| |||
602 | 611 | | |
603 | 612 | | |
604 | 613 | | |
605 | | - | |
| 614 | + | |
| 615 | + | |
606 | 616 | | |
607 | 617 | | |
608 | 618 | | |
| |||
662 | 672 | | |
663 | 673 | | |
664 | 674 | | |
665 | | - | |
| 675 | + | |
| 676 | + | |
666 | 677 | | |
667 | 678 | | |
668 | 679 | | |
| |||
722 | 733 | | |
723 | 734 | | |
724 | 735 | | |
725 | | - | |
| 736 | + | |
| 737 | + | |
726 | 738 | | |
727 | 739 | | |
728 | 740 | | |
| |||
782 | 794 | | |
783 | 795 | | |
784 | 796 | | |
785 | | - | |
| 797 | + | |
| 798 | + | |
786 | 799 | | |
787 | 800 | | |
788 | 801 | | |
| |||
848 | 861 | | |
849 | 862 | | |
850 | 863 | | |
851 | | - | |
| 864 | + | |
| 865 | + | |
852 | 866 | | |
853 | 867 | | |
854 | 868 | | |
| |||
908 | 922 | | |
909 | 923 | | |
910 | 924 | | |
911 | | - | |
| 925 | + | |
| 926 | + | |
912 | 927 | | |
913 | 928 | | |
914 | 929 | | |
| |||
963 | 978 | | |
964 | 979 | | |
965 | 980 | | |
966 | | - | |
| 981 | + | |
| 982 | + | |
967 | 983 | | |
968 | 984 | | |
969 | 985 | | |
| |||
1018 | 1034 | | |
1019 | 1035 | | |
1020 | 1036 | | |
1021 | | - | |
| 1037 | + | |
| 1038 | + | |
1022 | 1039 | | |
1023 | 1040 | | |
1024 | 1041 | | |
| |||
1078 | 1095 | | |
1079 | 1096 | | |
1080 | 1097 | | |
1081 | | - | |
| 1098 | + | |
| 1099 | + | |
1082 | 1100 | | |
1083 | 1101 | | |
1084 | 1102 | | |
| |||
1138 | 1156 | | |
1139 | 1157 | | |
1140 | 1158 | | |
1141 | | - | |
| 1159 | + | |
| 1160 | + | |
1142 | 1161 | | |
1143 | 1162 | | |
1144 | 1163 | | |
| |||
1214 | 1233 | | |
1215 | 1234 | | |
1216 | 1235 | | |
1217 | | - | |
| 1236 | + | |
| 1237 | + | |
1218 | 1238 | | |
1219 | 1239 | | |
1220 | 1240 | | |
| |||
0 commit comments