Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New subset strategy: create SELECT with WHERE clause strategy #74

Open
evoxmusic opened this issue Apr 30, 2022 · 3 comments
Open

New subset strategy: create SELECT with WHERE clause strategy #74

evoxmusic opened this issue Apr 30, 2022 · 3 comments
Labels
enhancement New feature or request feature New feature request

Comments

@evoxmusic
Copy link
Contributor

As a user, I want to select a subset of a database based on a SELECT and WHERE clause.

source:
  database_subset:
    database: public
    table: orders
    strategy_name: query
    strategy_options:
      query: "SELECT * FROM public.table WHERE customer_id = 'abcdef' AND total_cost_usd > 50"

It means that we need to create a small SQL parser to build a conditional tree and filter on those conditions.

Examples of queries we can support:

  • SELECT * FROM public.table WHERE customer_id = 'abcdef';
  • SELECT * FROM public.table WHERE customer_id = 'abcdef' AND total_cost_usd > 50;
  • SELECT * FROM public.table WHERE customer_id = 'abcdef' AND total_cost_usd < 50;
  • SELECT * FROM public.table WHERE customer_id = 'abcdef' AND total_cost_usd <= 50;
  • SELECT * FROM public.table WHERE customer_id = 'abcdef' AND total_cost_usd >= 50;
  • SELECT * FROM public.table WHERE customer_id = 'abcdef' AND total_cost_usd != 50;
  • SELECT * FROM public.table WHERE customer_id = 'abcdef' OR total_cost_usd > 50;
  • SELECT * FROM public.table WHERE customer_id = 'abcdef' OR total_cost_usd < 50;
  • SELECT * FROM public.table WHERE customer_id = 'abcdef' OR total_cost_usd <= 50;
  • SELECT * FROM public.table WHERE customer_id = 'abcdef' OR total_cost_usd >= 50;
  • SELECT * FROM public.table WHERE customer_id = 'abcdef' OR total_cost_usd != 50;

As an improvement, we can put database_subset.database and database_subset.table parameters into database_subset.strategy_options. Then, they will be optional depending on the subset strategy taken.

@evoxmusic evoxmusic added enhancement New feature or request feature New feature request labels Apr 30, 2022
@2Kable
Copy link
Contributor

2Kable commented May 2, 2022

This feature would be amazing,
We have data that spans across schema and I doubt the current percentage strategy would work
Furthermore, this would guarantee some consistency over seed data

@spegoraro
Copy link

Agreed! This would be awesome.

@sraka1
Copy link

sraka1 commented Aug 19, 2024

@evoxmusic is this project still being maintained? Subsequently, if yes, is there a roadmap/plan to implement these enhancements?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feature New feature request
Projects
None yet
Development

No branches or pull requests

4 participants