Merged
Conversation
- Added --with-stats flag to include schema statistics (table count, column count, etc.) - Added --with-row-count flag to include row counts for each table - Added --with-samples flag to include sample values for each column - Added --sample-size flag to control number of samples (default: 3) - Implemented StatisticsReader interface for PostgreSQL - Updated models to include optional statistics fields - Statistics collection continues even if some queries fail This helps users understand data volume and content patterns without manual queries.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces new schema statistics and data sampling features to the export and comparison commands, enhancing the ability to analyze and understand database schemas. The main changes include support for collecting table and column statistics (such as row counts and sample values), updates to the schema data model, and implementations for MySQL, PostgreSQL, and Oracle backends.
New statistics and sampling features:
cmd/schemalyzer/commands/export.go,cmd/schemalyzer/commands/compare.go). [1] [2]collectStatisticsfunction to aggregate statistics (table count, view count, total columns, index count, row counts, and column samples) when exporting or comparing schemas (cmd/schemalyzer/commands/common.go). [1] [2] [3]Schema model enhancements:
Schema,Table, andColumnstructs to include fields for overall statistics (Stats), per-table row counts (RowCount), and per-column sample values (Samples). Added a newSchemaStatsstruct to represent aggregated statistics (pkg/models/schema.go). [1] [2] [3] [4]Backend support for statistics:
StatisticsReaderinterface for retrieving row counts and column samples, and implemented it for MySQL, PostgreSQL, and Oracle readers, including safe identifier quoting and value conversion for each backend (internal/database/interfaces.go,internal/database/mysql/reader.go,internal/database/postgres/reader.go,internal/database/oracle/reader.go). [1] [2] [3] [4]