MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / test_over

Method test_over

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

Source from the content-addressed store, hash-verified

3061 self.assert_compile(stmt, expected_sql, dialect=dialect)
3062
3063 def test_over(self):
3064 self.assert_compile(func.row_number().over(), "row_number() OVER ()")
3065 self.assert_compile(
3066 func.row_number().over(
3067 order_by=[table1.c.name, table1.c.description]
3068 ),
3069 "row_number() OVER (ORDER BY mytable.name, mytable.description)",
3070 )
3071 self.assert_compile(
3072 func.row_number().over(
3073 partition_by=[table1.c.name, table1.c.description]
3074 ),
3075 "row_number() OVER (PARTITION BY mytable.name, "
3076 "mytable.description)",
3077 )
3078 self.assert_compile(
3079 func.row_number().over(
3080 partition_by=[table1.c.name], order_by=[table1.c.description]
3081 ),
3082 "row_number() OVER (PARTITION BY mytable.name "
3083 "ORDER BY mytable.description)",
3084 )
3085 self.assert_compile(
3086 func.row_number().over(
3087 partition_by=table1.c.name, order_by=table1.c.description
3088 ),
3089 "row_number() OVER (PARTITION BY mytable.name "
3090 "ORDER BY mytable.description)",
3091 )
3092
3093 self.assert_compile(
3094 func.row_number().over(
3095 partition_by=table1.c.name,
3096 order_by=[table1.c.name, table1.c.description],
3097 ),
3098 "row_number() OVER (PARTITION BY mytable.name "
3099 "ORDER BY mytable.name, mytable.description)",
3100 )
3101
3102 self.assert_compile(
3103 func.row_number().over(
3104 partition_by=[], order_by=[table1.c.name, table1.c.description]
3105 ),
3106 "row_number() OVER (ORDER BY mytable.name, mytable.description)",
3107 )
3108
3109 self.assert_compile(
3110 func.row_number().over(
3111 partition_by=[table1.c.name, table1.c.description], order_by=[]
3112 ),
3113 "row_number() OVER (PARTITION BY mytable.name, "
3114 "mytable.description)",
3115 )
3116
3117 self.assert_compile(
3118 func.row_number().over(partition_by=[], order_by=[]),
3119 "row_number() OVER ()",
3120 )

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