refactor(sampler): collapse SamplerInterface to a single typed config object#28147
refactor(sampler): collapse SamplerInterface to a single typed config object#28147edg956 wants to merge 3 commits into
Conversation
Replace the 9-parameter constructor/create() signature with a typed SamplerConfig hierarchy (SamplerConfig / DatabaseSamplerConfig / StorageSamplerConfig). Config resolution — partition_details, sample_query, include/exclude columns, sample_config, sample_data_count — now happens in callers (entity_adapters, profiler_source, base_test_suite_source) before construction, so the interface only receives already-resolved values. - Add sampler_config.py with SamplerConfig dataclass hierarchy - Remove database-specific imports from SamplerInterface base class - Move SSL connection setup and column include/exclude filtering to database-family subclasses (SQASampler, PandasSampler, NoSQLSampler) - Simplify BigQuery/Postgres/Snowflake samplers to *args/**kwargs init - Remove StorageSampler.create() override; base create() is sufficient - Update profiler_source and base_test_suite_source to build DatabaseSamplerConfig before calling sampler_class.create() Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The non-database adapter example was showing the old flat kwargs pattern (sample_config, sample_data_count) that SamplerInterface now silently ignores via **__. Replace with the correct "config": SamplerConfig(...) pattern that matches the actual ContainerAdapter implementation. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…check ClassifiableEntityType includes Container which has no tableType. The *args/**kwargs init simplified the constructor but lost the explicit Table type annotation, triggering a basedpyright error. Guard with isinstance(self.entity, Table) so the type checker knows tableType is only accessed on Table entities. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Code Review ✅ Approved 1 resolved / 1 findingsCollapses the SamplerInterface into a consolidated SamplerConfig object to simplify initialization and resolve the documentation error regarding incorrect kwargs for non-database adapters. No issues found. ✅ 1 resolved✅ Bug: Documentation shows incorrect kwargs for non-database adapters
OptionsDisplay: compact → Showing less information. Comment with these commands to change:
Was this helpful? React with 👍 / 👎 | Gitar |
|
🔴 Playwright Results — 1 failure(s), 13 flaky✅ 4066 passed · ❌ 1 failed · 🟡 13 flaky · ⏭️ 92 skipped
Genuine Failures (failed on all attempts)❌
|



Summary
SamplerConfigdataclass hierarchy (SamplerConfig→DatabaseSamplerConfig/StorageSamplerConfig) in a newsampler_config.pymoduleSamplerInterface.__init__/create()signature with a singleconfig: SamplerConfigparameter — eliminates thetoo-many-argumentspylint suppress and removes database-specific imports from the base classentity_adapters,profiler_source,base_test_suite_source) so the interface receives already-resolved valuesSQASampler,PandasSampler,NoSQLSampler) — storage samplers remain cleanBigQuerySampler,PostgresSampler,SnowflakeSamplerto*args/**kwargsinit (no longer need to re-declare 8 parameters)StorageSampler.create()override; the basecreate()is now sufficientstorage_config→upload_sample_storage_configon the interface to clarify it's the destination for sample data upload, not the service connectionTest plan
make unit_ingestion_dev_env)test_sampler_interface.py—storage_config→upload_sample_storage_configrename coveredtest_container_sampler_processor.py,test_burstiq_sampler.py— adapted to new config object🤖 Generated with Claude Code