Skip to content

Implement SQL challenge: 6 queries + pytest suite (11 tests) - #85

Open
shobitgupta-ui wants to merge 4 commits into
sbms4d:qa_testfrom
shobitgupta-ui:shobit/sql-solution-v2
Open

Implement SQL challenge: 6 queries + pytest suite (11 tests)#85
shobitgupta-ui wants to merge 4 commits into
sbms4d:qa_testfrom
shobitgupta-ui:shobit/sql-solution-v2

Conversation

@shobitgupta-ui

Copy link
Copy Markdown

Summary

Implemented weasb_sql_test technical challenge: 6 SQL queries + pytest suite.

Queries

  • create_employees.sql: Employee roster with manager relationships
  • create_expenses.sql: Itemized expense receipts
  • create_invoices.sql: Supplier & invoice tables (alphabetical IDs, EOM normalization)
  • find_manager_cycles.sql: Circular approval chain detection (recursive CTE)
  • calculate_largest_expensors.sql: Expense accountability report (KEY QUERY)
  • generate_supplier_payment_plans.sql: Monthly payment schedule

Testing

  • pytest suite: 11 test cases (all passing)
  • Validates: schema, threshold enforcement (>1000), sorting, null handling

Implementation

  • Recursive CTE for cycle detection
  • Window functions for deterministic ID assignment
  • Type-safe DECIMAL for currency
  • Comprehensive edge case handling
  • 90+ lines of comments per query

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant