MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_over

Method test_over

test/sql/test_compiler.py:3087–3201  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

3085 self.assert_compile(stmt, expected_sql, dialect=dialect)
3086
3087 def test_over(self):
3088 self.assert_compile(func.row_number().over(), "row_number() OVER ()")
3089 self.assert_compile(
3090 func.row_number().over(
3091 order_by=[table1.c.name, table1.c.description]
3092 ),
3093 "row_number() OVER (ORDER BY mytable.name, mytable.description)",
3094 )
3095 self.assert_compile(
3096 func.row_number().over(
3097 partition_by=[table1.c.name, table1.c.description]
3098 ),
3099 "row_number() OVER (PARTITION BY mytable.name, "
3100 "mytable.description)",
3101 )
3102 self.assert_compile(
3103 func.row_number().over(
3104 partition_by=[table1.c.name], order_by=[table1.c.description]
3105 ),
3106 "row_number() OVER (PARTITION BY mytable.name "
3107 "ORDER BY mytable.description)",
3108 )
3109 self.assert_compile(
3110 func.row_number().over(
3111 partition_by=table1.c.name, order_by=table1.c.description
3112 ),
3113 "row_number() OVER (PARTITION BY mytable.name "
3114 "ORDER BY mytable.description)",
3115 )
3116
3117 self.assert_compile(
3118 func.row_number().over(
3119 partition_by=table1.c.name,
3120 order_by=[table1.c.name, table1.c.description],
3121 ),
3122 "row_number() OVER (PARTITION BY mytable.name "
3123 "ORDER BY mytable.name, mytable.description)",
3124 )
3125
3126 self.assert_compile(
3127 func.row_number().over(
3128 partition_by=[], order_by=[table1.c.name, table1.c.description]
3129 ),
3130 "row_number() OVER (ORDER BY mytable.name, mytable.description)",
3131 )
3132
3133 self.assert_compile(
3134 func.row_number().over(
3135 partition_by=[table1.c.name, table1.c.description], order_by=[]
3136 ),
3137 "row_number() OVER (PARTITION BY mytable.name, "
3138 "mytable.description)",
3139 )
3140
3141 self.assert_compile(
3142 func.row_number().over(partition_by=[], order_by=[]),
3143 "row_number() OVER ()",
3144 )

Callers

nothing calls this directly

Calls 9

selectFunction · 0.90
columnFunction · 0.90
overFunction · 0.90
assert_compileMethod · 0.80
maxMethod · 0.80
overMethod · 0.45
labelMethod · 0.45
fooMethod · 0.45
aliasMethod · 0.45

Tested by

no test coverage detected