Comments (3)
What would need to change in metricflow code so this join can be generated?
FROM metricflow.user_assignments ua
LEFT JOIN fact.transactions e
ON ua.subject_id = e.subject_id AND e.created_at BETWEEN ua.first_assigned_at and {{ analysis_date }}
Iām not sure where to start looking into this.
I played with metricflow as a new user a bit and I can kind of get to that SQL, except the join order I have is wrong: transaction on the left but I want assignments, so assigned customer with no transactions can have a null or 0 in the output.
from metricflow.
@tlento š @Jstein77 said you would be a good person to look at this.
from metricflow.
Thanks for commenting, @TristanBoudreault!
I have a couple of thoughts:
- Have you checked out the logic for SCD-style joins? The code is here. This is a similar pattern to what you're after, where
assigned_at
is the start of the validity window andanalysis_date
would be the end of the window. One difference is that the end of the validity window is not dynamic, so that might be an issue. - The way the joins are currently rendered is the inverse of what we need for experimentation. We need to
LEFT OUTER JOIN
the metrics table onto the assignment table.
Right now:
SELECT b.condition AS user__condition, SUM(1)
FROM transactions a
LEFT OUTER JOIN user_assignments b
ON a.user_id = b.user_id AND {{ date range stuff }}
What we need:
SELECT a.condition AS user__condition, SUM(1)
FROM user_assignments a
LEFT OUTER JOIN transactions b
ON a.user_id = b.user_id AND {{ date range stuff }}
We should probably add first class support for this type of join since it's used in any kind of custom sample tracking analysis where you want to always include all members of the in sample group and nobody else i.e experimentation, cohort metrics.
from metricflow.
Related Issues (20)
- [SL-1628] Update dataflow plan to push predicates down to semantic model source queries where possible
- [SL-1629] Enable support for predicate pushdown for queries involving time range adjustments (e.g., offsets, cumulative)
- [SL-1630] Enable automatic time range adjustments for standard sets of time filter predicates
- [SL-1631] Ensure predicate rendering is compatible with partition pruning directives across relevant engines
- [SL-1633] [Feature] Support metric/measure filters
- [SL-1634] [Feature] Support Dimension-only queries for SCD dimensions HOT 2
- [SL-1642] [Feature] Add Support for Consistent SQL Query Generation
- [SL-1704] [SL-1703] [Feature] Enable `fill_nulls_with` and `join_to_timespine` on metric spec
- [SL-1711] [Feature] Support resolution of time dimension grain when using Dimension() object syntax HOT 2
- [SL-1720] [Feature] Remove SQL-Comment-Based Tags
- [SL-1721] [Feature] Consistent SQL Generation HOT 1
- [SL-1725] [Feature] Reference a measure from another semantic model.
- [SL-1732] [Bug] Where filter is applied to inner query when using `join_to_timespine`
- [SL-1756] [SL-1755] [Feature] Use CTEs instead of sub queries in generated SQL
- [SL-1757] [Feature] Specify a partition key for exports
- [SL-1802] [Bug] `join_to_timespine` not applied for conversion metrics
- [SL-1805] [Bug] set.intersection calls can raise inscrutable errors
- [SL-1810] [Bug] Querying a time offset metric with multiple `metric_time` dimensions returns incorrect results
- [SL-1811] [Bug] Offset metric error when querying with one grain & filtering with another
- [Feature] Add/Expose documentation for metric flow package HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
š Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ššš
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ā¤ļø Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from metricflow.