Joins

class snuba_sdk.relationships.Join(relationships)[source]

Bases: snuba_sdk.expressions.Expression

A collection of relationships that is used in the MATCH section of the SnQL query. Must contain at least one Relationship, and will make sure that Entity aliases are not used by different Entities.

Parameters

relationships (Sequence[Relationship]) – The relationships in the join.

Raises

InvalidExpressionError – If two different Entities are using the same alias, this will be raised.

get_alias_mappings()[source]
get_entities()[source]
relationships: Sequence[snuba_sdk.relationships.Relationship]
validate()[source]
Return type

None

class snuba_sdk.relationships.Relationship(lhs, name, rhs)[source]

Bases: snuba_sdk.expressions.Expression

A representation of a relationship between two Entities. The relationship name should be defined in the data model of the LHS and entity in Snuba. Both Entities must have a valid alias, which will be used to qualify the columns in the SnQL query.

Parameters
  • lhs (Entity) – The Entity that owns the relationship.

  • name (Entity) – The name of the relationship on the LHS Entity.

  • rhs (Entity) – The Entity connected to the LHS using the relationship.

Raises

InvalidExpressionError – If the incorrect types are used or if either of the Entities does not have an alias.

lhs: snuba_sdk.entity.Entity
name: str
rhs: snuba_sdk.entity.Entity
validate()[source]
Return type

None