zmc
2023-08-08 e792e9a60d958b93aef96050644f369feb25d61b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
U
¸ý°dåÛã@sêUdZddlmZddlZddlZddlmZddlmZddlmZddlm    Z    ddlm
Z
dd    lm Z dd
lm Z dd lm Z dd lmZdd lmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlm Z ddlm!Z!ddl"m#Z#ddl"m$Z$ddl"m%Z%dd l"m&Z&dd!l"m'Z'dd"l"m(Z(dd#l"m)Z)dd$l"m*Z*dd%l"m+Z+dd&l"m,Z,dd'l"m-Z-dd(l"m.Z.dd)l"m/Z/dd*l0m1Z1dd+l0m2Z2dd,l0m3Z3dd-lm4Z4dd.lm5Z5dd/l6m7Z7d0dlmZertdd1lm8Z8d0d2l9m:Z:d0d3l;m<Z<d0d4l=m>Z>d0d5l=m?Z?ed6ed7Z@e AeB¡ZCd8eDd9<dd;d<„ZEGd=d>„d>ee(e@e1e ƒZFGd?d@„d@e$eƒZGGdAdB„dBe-e@ƒZHGdCdD„dDƒZIeIƒZJeIjeJ_eIdEdFZKGdGdH„dHeFe@ƒZLGdIdJ„dJeLe@ƒZMeEdKe&ƒeEdLe)ƒGdMdN„dNeMeNƒZOGdOdP„dPeMe@ƒZPGdQdR„dReMe@ƒZQGdSdT„dTeQe@ƒZRGdUdV„dVeQe@ƒZSGdWdX„dXeQe@ƒZTGdYdZ„dZeQe@ƒZUGd[d\„d\eMejƒZVGd]d^„d^eMeWƒZXGd_d`„d`eMeNƒZYGdadb„dbeMeZƒZ[Gdcdd„ddeMeNƒZ\Gdedf„dfePej]ƒZ^Gdgdh„dhePej_ƒZ`Gdidj„djePejƒZaGdkdl„dlePeWƒZbGdmdn„dnePejƒZcGdodp„dpePejƒZdGdqdr„drePeWƒZeGdsdt„dtePejƒZfGdudv„dvePeWƒZgGdwdx„dxeMe@ƒZhGdydz„dzeMe@ƒZiGd{d|„d|eie@ƒZjGd}d~„d~eie@ƒZkGdd€„d€eie@ƒZlGdd‚„d‚eMeNƒZmGdƒd„„d„eMeNƒZnGd…d†„d†eMejoƒZpGd‡dˆ„dˆeMejoƒZqGd‰dŠ„dŠeMe@ƒZrGd‹dŒ„dŒeMe@ƒZsGddŽ„dŽeMe@ƒZtdS)z6SQL function API, factories, and built-in functions.
 
é)Ú annotationsN)ÚAny)Úcast)ÚDict)ÚMapping)ÚOptional)Úoverload)ÚTuple)ÚType)Ú TYPE_CHECKING)ÚTypeVaré)Ú
annotation)Ú    coercions)Ú    operators)Úroles)Úschema)Úsqltypes)Útype_api)Úutil)Úis_table_value_type)Ú_entity_namespace)ÚColumnCollection)Ú
Executable)Ú
Generative)Ú HasMemoized)Ú_type_from_args)ÚBinaryExpression)Ú BindParameter)ÚCast)Ú
ClauseList)Ú ColumnElement)ÚExtract©ÚFunctionFilter)ÚGrouping)Úliteral_column)Ú NamedColumn©ÚOver©Ú WithinGroup)Ú
FromClause)ÚSelect)ÚTableValuedAlias)ÚTableValueType)Ú
TypeEngine)ÚInternalTraversalé)Ú_TypeEngineArgument)Ú
Connection)Ú CursorResult)Ú_CoreMultiExecuteParams)ÚCoreExecuteOptionsParameterÚ_T)Úboundz5util.defaultdict[str, Dict[str, Type[Function[Any]]]]Ú    _registryÚ_defaultcCs8t|}t|ƒ ¡}||kr,t d |¡¡|||<dS)zþAssociate a callable with a particular func. name.
 
    This is normally called by GenericFunction, but is also
    available by itself so that a non-Function construct
    can be associated with the :data:`.func` accessor (i.e.
    CAST, EXTRACT).
 
    zMThe GenericFunction '{}' is already registered and is going to be overridden.N)r:ÚstrÚlowerrÚwarnÚformat)Ú
identifierÚfnÚpackageÚreg©rDúOd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\sqlalchemy/sql/functions.pyÚregister_functionNs     ÿÿrFcsveZdZUdZdejfdejfdejfgZdZ    de
d<dZ dZ d    Z d
e
d<d e
d <d e
d <de
d<d dœdd„Zd    Ze‡fdd„ƒZdddddœdd„ZdDdd„Zdd„ZdEdd „Zejd!d"„ƒZejd#d$„ƒZed%d&„ƒZed'd(„ƒZejd)d*œd+d,„ƒZdFd-d.„Z d/d0„Z!d1d2„Z"d3d4„Z#ed5d6„ƒZ$d7d8„Z%dGd9d:„Z&d;d*œd<d=„Z'dHd>d?„Z(dI‡fd@dA„    Z)edBdC„ƒZ*‡Z+S)JÚFunctionElementa˜Base for SQL function-oriented constructs.
 
    This is a `generic type <https://peps.python.org/pep-0484/#generics>`_,
    meaning that type checkers and IDEs can be instructed on the types to
    expect in a :class:`_engine.Result` for this function. See
    :class:`.GenericFunction` for an example of how this is done.
 
    .. seealso::
 
        :ref:`tutorial_functions` - in the :ref:`unified_tutorial`
 
        :class:`.Function` - named SQL function.
 
        :data:`.func` - namespace which produces registered or ad-hoc
        :class:`.Function` instances.
 
        :class:`.GenericFunction` - allows creation of registered function
        types.
 
    Ú clause_exprÚ_with_ordinalityÚ_table_value_typerDzTuple[str, ...]Ú packagenamesFNzOptional[TableValueType]rZ primary_keyZ _is_clone_ofz Grouping[Any])Úclausescs>‡fdd„|Dƒ}ˆjpt|ƒˆ_tt|tjddœŽƒˆ_dS)aOConstruct a :class:`.FunctionElement`.
 
        :param \*clauses: list of column expressions that form the arguments
         of the SQL function call.
 
        :param \**kwargs:  additional kwargs are typically consumed by
         subclasses.
 
        .. seealso::
 
            :data:`.func`
 
            :class:`.Function`
 
        c    s(g|] }tjtj|tˆddƒˆd‘qS)ÚnameN©rMÚapply_propagate_attrs)rÚexpectrÚExpressionElementRoleÚgetattr©Ú.0Úc©ÚselfrDrEÚ
<listcomp>sú
üz,FunctionElement.__init__.<locals>.<listcomp>T©ÚoperatorZgroup_contentsN)Ú    _has_argsÚboolr%r rÚcomma_oprH)rWrLÚargsrDrVrEÚ__init__s
ù    ÿzFunctionElement.__init__cstƒjpt|ddƒS)NrM)ÚsuperÚ
_proxy_keyrRrV©Ú    __class__rDrEra­szFunctionElement._proxy_keyr4r6r7zCursorResult[Any])Ú
connectionÚdistilled_paramsÚexecution_optionsÚreturncCs| |||¡S©N)Z_execute_function)rWrdrerfrDrDrEÚ_execute_on_connection±s
ÿz&FunctionElement._execute_on_connectioncCs t|||ƒS)aªReturn a column expression that's against this
        :class:`_functions.FunctionElement` as a scalar
        table-valued expression.
 
        The returned expression is similar to that returned by a single column
        accessed off of a :meth:`_functions.FunctionElement.table_valued`
        construct, except no FROM clause is generated; the function is rendered
        in the similar way as a scalar subquery.
 
        E.g.:
 
        .. sourcecode:: pycon+sql
 
            >>> from sqlalchemy import func, select
            >>> fn = func.jsonb_each("{'k', 'v'}").scalar_table_valued("key")
            >>> print(select(fn))
            {printsql}SELECT (jsonb_each(:jsonb_each_1)).key
 
        .. versionadded:: 1.4.0b2
 
        .. seealso::
 
            :meth:`_functions.FunctionElement.table_valued`
 
            :meth:`_functions.FunctionElement.alias`
 
            :meth:`_functions.FunctionElement.column_valued`
 
        )ÚScalarFunctionColumn)rWrMÚtype_rDrDrEÚscalar_table_valued»sz#FunctionElement.scalar_table_valuedcOs^| ¡}| dd¡}| dd¡}| dd¡}|r@||f7}d|_t|Ž|_|_|j||dS)aÁ Return a :class:`_sql.TableValuedAlias` representation of this
        :class:`_functions.FunctionElement` with table-valued expressions added.
 
        e.g.:
 
        .. sourcecode:: pycon+sql
 
            >>> fn = (
            ...     func.generate_series(1, 5).
            ...     table_valued("value", "start", "stop", "step")
            ... )
 
            >>> print(select(fn))
            {printsql}SELECT anon_1.value, anon_1.start, anon_1.stop, anon_1.step
            FROM generate_series(:generate_series_1, :generate_series_2) AS anon_1{stop}
 
            >>> print(select(fn.c.value, fn.c.stop).where(fn.c.value > 2))
            {printsql}SELECT anon_1.value, anon_1.stop
            FROM generate_series(:generate_series_1, :generate_series_2) AS anon_1
            WHERE anon_1.value > :value_1{stop}
 
        A WITH ORDINALITY expression may be generated by passing the keyword
        argument "with_ordinality":
 
        .. sourcecode:: pycon+sql
 
            >>> fn = func.generate_series(4, 1, -1).table_valued("gen", with_ordinality="ordinality")
            >>> print(select(fn))
            {printsql}SELECT anon_1.gen, anon_1.ordinality
            FROM generate_series(:generate_series_1, :generate_series_2, :generate_series_3) WITH ORDINALITY AS anon_1
 
        :param \*expr: A series of string column names that will be added to the
         ``.c`` collection of the resulting :class:`_sql.TableValuedAlias`
         construct as columns.  :func:`_sql.column` objects with or without
         datatypes may also be used.
 
        :param name: optional name to assign to the alias name that's generated.
         If omitted, a unique anonymizing name is used.
 
        :param with_ordinality: string name that when present results in the
         ``WITH ORDINALITY`` clause being added to the alias, and the given
         string name will be added as a column to the .c collection
         of the resulting :class:`_sql.TableValuedAlias`.
 
        :param joins_implicitly: when True, the table valued function may be
         used in the FROM clause without any explicit JOIN to other tables
         in the SQL query, and no "cartesian product" warning will be generated.
         May be useful for SQL functions such as ``func.json_each()``.
 
         .. versionadded:: 1.4.33
 
        .. versionadded:: 1.4.0b2
 
 
        .. seealso::
 
            :ref:`tutorial_functions_table_valued` - in the :ref:`unified_tutorial`
 
            :ref:`postgresql_table_valued` - in the :ref:`postgresql_toplevel` documentation
 
            :meth:`_functions.FunctionElement.scalar_table_valued` - variant of
            :meth:`_functions.FunctionElement.table_valued` which delivers the
            complete table valued expression as a scalar column expression
 
            :meth:`_functions.FunctionElement.column_valued`
 
            :meth:`_sql.TableValuedAlias.render_derived` - renders the alias
            using a derived column clause, e.g. ``AS name(col1, col2, ...)``
 
        Úwith_ordinalityNÚjoins_implicitlyrMT©rMrn)Z    _generateÚpoprIr/ÚtyperJÚalias)rWÚexprÚkwÚnew_funcrmrnrMrDrDrEÚ table_valuedÜsH   
zFunctionElement.table_valuedcCs|j||djS)aQReturn this :class:`_functions.FunctionElement` as a column expression that
        selects from itself as a FROM clause.
 
        E.g.:
 
        .. sourcecode:: pycon+sql
 
            >>> from sqlalchemy import select, func
            >>> gs = func.generate_series(1, 5, -1).column_valued()
            >>> print(select(gs))
            {printsql}SELECT anon_1
            FROM generate_series(:generate_series_1, :generate_series_2, :generate_series_3) AS anon_1
 
        This is shorthand for::
 
            gs = func.generate_series(1, 5, -1).alias().column
 
        :param name: optional name to assign to the alias name that's generated.
         If omitted, a unique anonymizing name is used.
 
        :param joins_implicitly: when True, the "table" portion of the column
         valued function may be a member of the FROM clause without any
         explicit JOIN to other tables in the SQL query, and no "cartesian
         product" warning will be generated. May be useful for SQL functions
         such as ``func.json_array_elements()``.
 
         .. versionadded:: 1.4.46
 
        .. seealso::
 
            :ref:`tutorial_functions_column_valued` - in the :ref:`unified_tutorial`
 
            :ref:`postgresql_column_valued` - in the :ref:`postgresql_toplevel` documentation
 
            :meth:`_functions.FunctionElement.table_valued`
 
        ro)rrÚcolumn©rWrMrnrDrDrEÚ column_valued2s'zFunctionElement.column_valuedcCs|jS)aThe set of columns exported by this :class:`.FunctionElement`.
 
        This is a placeholder collection that allows the function to be
        placed in the FROM clause of a statement:
 
        .. sourcecode:: pycon+sql
 
            >>> from sqlalchemy import column, select, func
            >>> stmt = select(column('x'), column('y')).select_from(func.myfunction())
            >>> print(stmt)
            {printsql}SELECT x, y FROM myfunction()
 
        The above form is a legacy feature that is now superseded by the
        fully capable :meth:`_functions.FunctionElement.table_valued`
        method; see that method for details.
 
        .. seealso::
 
            :meth:`_functions.FunctionElement.table_valued` - generates table-valued
            SQL function expressions.
 
        )rUrVrDrDrEÚcolumns[szFunctionElement.columnscCstdd„|jDƒdS)z-synonym for :attr:`.FunctionElement.columns`.cSsg|]}|j|f‘qSrD)Úkey)rTÚcolrDrDrErXzsz%FunctionElement.c.<locals>.<listcomp>©rz)rÚ_all_selected_columnsrVrDrDrErUusÿzFunctionElement.ccCs$t|jƒr|jj}n | d¡g}|Srh)rrqZ    _elementsÚlabel)rWÚcolsrDrDrEr~}s
 
 z%FunctionElement._all_selected_columnscCs|jSrhr}rVrDrDrEÚexported_columns†sz FunctionElement.exported_columnsr ©rgcCstt|jjƒS)z}Return the underlying :class:`.ClauseList` which contains
        the arguments for this :class:`.FunctionElement`.
 
        )rr rHÚelementrVrDrDrErLŠszFunctionElement.clausescCst|||||dS)aAProduce an OVER clause against this function.
 
        Used against aggregate or so-called "window" functions,
        for database backends that support window functions.
 
        The expression::
 
            func.row_number().over(order_by='x')
 
        is shorthand for::
 
            from sqlalchemy import over
            over(func.row_number(), order_by='x')
 
        See :func:`_expression.over` for a full description.
 
        .. seealso::
 
            :func:`_expression.over`
 
            :ref:`tutorial_window_functions` - in the :ref:`unified_tutorial`
 
        )Ú partition_byÚorder_byÚrowsÚrange_r()rWr„r…r†r‡rDrDrEÚover’sûzFunctionElement.overcGst|f|žŽS)aÐProduce a WITHIN GROUP (ORDER BY expr) clause against this function.
 
        Used against so-called "ordered set aggregate" and "hypothetical
        set aggregate" functions, including :class:`.percentile_cont`,
        :class:`.rank`, :class:`.dense_rank`, etc.
 
        See :func:`_expression.within_group` for a full description.
 
        .. seealso::
 
            :ref:`tutorial_functions_within_group` -
            in the :ref:`unified_tutorial`
 
 
        r*)rWr…rDrDrEÚ within_group²szFunctionElement.within_groupcGs|s|St|f|žŽS)a&Produce a FILTER clause against this function.
 
        Used against aggregate and window functions,
        for database backends that support the "FILTER" clause.
 
        The expression::
 
            func.count(1).filter(True)
 
        is shorthand for::
 
            from sqlalchemy import funcfilter
            funcfilter(func.count(1), True)
 
        .. seealso::
 
            :ref:`tutorial_functions_within_group` -
            in the :ref:`unified_tutorial`
 
            :class:`.FunctionFilter`
 
            :func:`.funcfilter`
 
 
        r#)rWZ    criterionrDrDrEÚfilterÄszFunctionElement.filtercCs t|||ƒS)a^ Interpret this expression as a boolean comparison between two
        values.
 
        This method is used for an ORM use case described at
        :ref:`relationship_custom_operator_sql_function`.
 
        A hypothetical SQL function "is_equal()" which compares to values
        for equality would be written in the Core expression language as::
 
            expr = func.is_equal("a", "b")
 
        If "is_equal()" above is comparing "a" and "b" for equality, the
        :meth:`.FunctionElement.as_comparison` method would be invoked as::
 
            expr = func.is_equal("a", "b").as_comparison(1, 2)
 
        Where above, the integer value "1" refers to the first argument of the
        "is_equal()" function and the integer value "2" refers to the second.
 
        This would create a :class:`.BinaryExpression` that is equivalent to::
 
            BinaryExpression("a", "b", operator=op.eq)
 
        However, at the SQL level it would still render as
        "is_equal('a', 'b')".
 
        The ORM, when it loads a related object or collection, needs to be able
        to manipulate the "left" and "right" sides of the ON clause of a JOIN
        expression. The purpose of this method is to provide a SQL function
        construct that can also supply this information to the ORM, when used
        with the :paramref:`_orm.relationship.primaryjoin` parameter. The
        return value is a containment object called :class:`.FunctionAsBinary`.
 
        An ORM example is as follows::
 
            class Venue(Base):
                __tablename__ = 'venue'
                id = Column(Integer, primary_key=True)
                name = Column(String)
 
                descendants = relationship(
                    "Venue",
                    primaryjoin=func.instr(
                        remote(foreign(name)), name + "/"
                    ).as_comparison(1, 2) == 1,
                    viewonly=True,
                    order_by=name
                )
 
        Above, the "Venue" class can load descendant "Venue" objects by
        determining if the name of the parent Venue is contained within the
        start of the hypothetical descendant value's name, e.g. "parent1" would
        match up to "parent1/child1", but not to "parent2/child1".
 
        Possible use cases include the "materialized path" example given above,
        as well as making use of special SQL functions such as geometric
        functions to create join conditions.
 
        :param left_index: the integer 1-based index of the function argument
         that serves as the "left" side of the expression.
        :param right_index: the integer 1-based index of the function argument
         that serves as the "right" side of the expression.
 
        .. versionadded:: 1.3
 
        .. seealso::
 
            :ref:`relationship_custom_operator_sql_function` -
            example use within the ORM
 
        )ÚFunctionAsBinary)rWÚ
left_indexÚ right_indexrDrDrEÚ as_comparisonâsHzFunctionElement.as_comparisoncCs|jjSrh)rLÚ _from_objectsrVrDrDrEr,szFunctionElement._from_objectscCsdS)aFor types that define their return type as based on the criteria
        within a WITHIN GROUP (ORDER BY) expression, called by the
        :class:`.WithinGroup` construct.
 
        Returns None by default, in which case the function's normal ``.type``
        is used.
 
        NrD)rWr‰rDrDrEÚwithin_group_type0s
z!FunctionElement.within_group_typecCstj|||j|dS)a+
Produce a :class:`_expression.Alias` construct against this
        :class:`.FunctionElement`.
 
        .. tip::
 
            The :meth:`_functions.FunctionElement.alias` method is part of the
            mechanism by which "table valued" SQL functions are created.
            However, most use cases are covered by higher level methods on
            :class:`_functions.FunctionElement` including
            :meth:`_functions.FunctionElement.table_valued`, and
            :meth:`_functions.FunctionElement.column_valued`.
 
        This construct wraps the function in a named alias which
        is suitable for the FROM clause, in the style accepted for example
        by PostgreSQL.  A column expression is also provided using the
        special ``.column`` attribute, which may
        be used to refer to the output of the function as a scalar value
        in the columns or where clause, for a backend such as PostgreSQL.
 
        For a full table-valued expression, use the
        :meth:`_functions.FunctionElement.table_valued` method first to
        establish named columns.
 
        e.g.:
 
        .. sourcecode:: pycon+sql
 
            >>> from sqlalchemy import func, select, column
            >>> data_view = func.unnest([1, 2, 3]).alias("data_view")
            >>> print(select(data_view.column))
            {printsql}SELECT data_view
            FROM unnest(:unnest_1) AS data_view
 
        The :meth:`_functions.FunctionElement.column_valued` method provides
        a shortcut for the above pattern:
 
        .. sourcecode:: pycon+sql
 
            >>> data_view = func.unnest([1, 2, 3]).column_valued("data_view")
            >>> print(select(data_view))
            {printsql}SELECT data_view
            FROM unnest(:unnest_1) AS data_view
 
        .. versionadded:: 1.4.0b2  Added the ``.column`` accessor
 
        :param name: alias name, will be rendered as ``AS <name>`` in the
         FROM clause
 
        :param joins_implicitly: when True, the table valued function may be
         used in the FROM clause without any explicit JOIN to other tables
         in the SQL query, and no "cartesian product" warning will be
         generated.  May be useful for SQL functions such as
         ``func.json_each()``.
 
         .. versionadded:: 1.4.33
 
        .. seealso::
 
            :ref:`tutorial_functions_table_valued` -
            in the :ref:`unified_tutorial`
 
            :meth:`_functions.FunctionElement.table_valued`
 
            :meth:`_functions.FunctionElement.scalar_table_valued`
 
            :meth:`_functions.FunctionElement.column_valued`
 
 
        )rMZtable_value_typern)r.Z
_constructrqrxrDrDrErr<s GüzFunctionElement.aliasz Select[Any]cCs t|ƒ}|jr|jf|jŽ}|S)z³Produce a :func:`_expression.select` construct
        against this :class:`.FunctionElement`.
 
        This is shorthand for::
 
            s = select(function_element)
 
        )r-Z_execution_optionsrf)rWÚsrDrDrEÚselectŠs    zFunctionElement.selectcKstd|f||jd|dœ|—ŽS)NT)Ú_compared_to_operatorÚ_compared_to_typeÚuniquerk)rrq©rWrZÚobjrkrtrDrDrEÚ _bind_param˜sþúùzFunctionElement._bind_paramcs2|tjkr t|jtjƒr t|ƒStƒj|dSdS)N)Úagainst)    rÚgetitemÚ
isinstancerqrÚARRAYr%r`Ú
self_group)rWr™rbrDrEr£s  ÿzFunctionElement.self_groupcCs
t|jƒS)zzoverrides FromClause.entity_namespace as functions are generally
        column expressions and not FromClauses.
 
        )rrHrVrDrDrEÚentity_namespace¯sz FunctionElement.entity_namespace)N)NF)NNNN)NF)N)N),Ú__name__Ú
__module__Ú __qualname__Ú__doc__r1Údp_clauseelementZ
dp_booleanZdp_has_cache_keyÚ_traverse_internalsrKÚ__annotations__r[rIrJr_Z_non_anon_labelÚpropertyrarirlrvryrZro_non_memoized_propertyrzZro_memoized_propertyrUr~rrZmemoized_attributerLrˆr‰rŠrŽrrrrr’r˜rržÚ __classcell__rDrDrbrErGdsV
ý  
 
!V
)
 
 
 
 
 J
 
N
 rGc@sÀeZdZUdejfdejfdejfdejfgZded<ded<ded<dd„Z    dddd    œd
d „Z
e d d œdd„ƒZ e j d ddœdd„ƒZ e d d œdd„ƒZej d ddœdd„ƒZes¼e ZeZdS)r‹Ú sql_functionrŒrÚ    modifierszFunctionElement[Any]ÚintcCst |||¡Srh)r!Ú_gen_cache_key)rWZanon_mapZ
bindparamsrDrDrEr«ÆszFunctionAsBinary._gen_cache_key)rArŒrcCs8||_||_||_tj|_tj|_d|_    d|_
i|_ dS)NT) r¨rŒrrZfunction_as_comparison_oprZrZ BOOLEANTYPErqÚnegateZ_is_implicitly_booleanr©)rWrArŒrrDrDrEr_ÉszFunctionAsBinary.__init__zColumnElement[Any]r‚cCs|jjj|jdS©Nr ©r¨rLrŒrVrDrDrEÚ    left_exprÖszFunctionAsBinary.left_exprÚNone)ÚvaluergcCs||jjj|jd<dSr­r®©rWr±rDrDrEr¯ÚscCs|jjj|jdSr­©r¨rLrrVrDrDrEÚ
right_exprÞszFunctionAsBinary.right_exprcCs||jjj|jd<dSr­r³r²rDrDrEr´âsN)rŸr r¡r1r£Ú dp_plain_objZ dp_plain_dictr¤r¥r«r_r¦r¯Úsetterr´r ÚleftÚrightrDrDrDrEr‹ºs*
ü r‹c@sHeZdZdZdejfdejfdejfgZdZ    dZ
d ddd    d
œd d „Z dS)rjZscalar_function_columnrMrqrAFNzFunctionElement[_T]r<ú!Optional[_TypeEngineArgument[_T]])rArMrkcCs||_||_t |¡|_dSrh)rArMrÚ to_instancerq)rWrArMrkrDrDrEr_úszScalarFunctionColumn.__init__)N) rŸr r¡Ú__visit_name__r1Z dp_anon_nameÚdp_typer£r¤Z
is_literalÚtabler_rDrDrDrErjîsýürjc@säeZdZdZdd„Zdddœdd„Zedd    dd
d œd d „ƒZeddddœdd „ƒZddddœdd „Zeràe    ddœdd„ƒZ
e    ddœdd„ƒZ e    ddœdd„ƒZ e    ddœdd„ƒZ e    ddœd d!„ƒZe    d"dœd#d$„ƒZe    d%dœd&d'„ƒZe    d(dœd)d*„ƒZe    d+dœd,d-„ƒZe    d.dœd/d0„ƒZe    d1dœd2d3„ƒZe    d4dœd5d6„ƒZe    d7dœd8d9„ƒZe    d:dœd;d<„ƒZe    d=dœd>d?„ƒZe    d@dœdAdB„ƒZe    dCdœdDdE„ƒZe    dFdœdGdH„ƒZe    dIdœdJdK„ƒZe    dLdœdMdN„ƒZe    dOdœdPdQ„ƒZe    dRdœdSdT„ƒZe    dUdœdVdW„ƒZ e    dXdœdYdZ„ƒZ!e    d[dœd\d]„ƒZ"e    d^dœd_d`„ƒZ#e    dadœdbdc„ƒZ$e    dddœdedf„ƒZ%e    dgdœdhdi„ƒZ&e    djdœdkdl„ƒZ'e    dmdœdndo„ƒZ(e    dpdœdqdr„ƒZ)e    dsdœdtdu„ƒZ*e    dvdœdwdx„ƒZ+e    dydœdzd{„ƒZ,d|S)}Ú_FunctionGeneratora‡ Generate SQL function expressions.
 
    :data:`.func` is a special object instance which generates SQL
    functions based on name-based attributes, e.g.:
 
    .. sourcecode:: pycon+sql
 
        >>> print(func.count(1))
        {printsql}count(:param_1)
 
    The returned object is an instance of :class:`.Function`, and  is a
    column-oriented SQL element like any other, and is used in that way:
 
    .. sourcecode:: pycon+sql
 
        >>> print(select(func.count(table.c.id)))
        {printsql}SELECT count(sometable.id) FROM sometable
 
    Any name can be given to :data:`.func`. If the function name is unknown to
    SQLAlchemy, it will be rendered exactly as is. For common SQL functions
    which SQLAlchemy is aware of, the name may be interpreted as a *generic
    function* which will be compiled appropriately to the target database:
 
    .. sourcecode:: pycon+sql
 
        >>> print(func.current_timestamp())
        {printsql}CURRENT_TIMESTAMP
 
    To call functions which are present in dot-separated packages,
    specify them in the same manner:
 
    .. sourcecode:: pycon+sql
 
        >>> print(func.stats.yield_curve(5, 10))
        {printsql}stats.yield_curve(:yield_curve_1, :yield_curve_2)
 
    SQLAlchemy can be made aware of the return type of functions to enable
    type-specific lexical and result-based behavior. For example, to ensure
    that a string-based function returns a Unicode value and is similarly
    treated as a string in expressions, specify
    :class:`~sqlalchemy.types.Unicode` as the type:
 
    .. sourcecode:: pycon+sql
 
        >>> print(func.my_string(u'hi', type_=Unicode) + ' ' +
        ...       func.my_string(u'there', type_=Unicode))
        {printsql}my_string(:my_string_1) || :my_string_2 || my_string(:my_string_3)
 
    The object returned by a :data:`.func` call is usually an instance of
    :class:`.Function`.
    This object meets the "column" interface, including comparison and labeling
    functions.  The object can also be passed the :meth:`~.Connectable.execute`
    method of a :class:`_engine.Connection` or :class:`_engine.Engine`,
    where it will be
    wrapped inside of a SELECT statement first::
 
        print(connection.execute(func.current_timestamp()).scalar())
 
    In a few exception cases, the :data:`.func` accessor
    will redirect a name to a built-in expression such as :func:`.cast`
    or :func:`.extract`, as these names have well-known meaning
    but are not exactly the same as "functions" from a SQLAlchemy
    perspective.
 
    Functions which are interpreted as "generic" functions know how to
    calculate their return type automatically. For a listing of known generic
    functions, see :ref:`generic_functions`.
 
    .. note::
 
        The :data:`.func` construct has only limited support for calling
        standalone "stored procedures", especially those with special
        parameterization concerns.
 
        See the section :ref:`stored_procedures` for details on how to use
        the DBAPI-level ``callproc()`` method for fully traditional stored
        procedures.
 
    .. seealso::
 
        :ref:`tutorial_functions` - in the :ref:`unified_tutorial`
 
        :class:`.Function`
 
    cKsg|_||_dSrh)Ú_FunctionGenerator__namesÚopts)rWrÀrDrDrEr__sz_FunctionGenerator.__init__r<)rMrgcCsn| d¡r6z |j|WStk
r2t|ƒ‚YqLXn| d¡rL|dd…}tf|jŽ}t|jƒ|g|_|S)NÚ__Ú_réÿÿÿÿ)    Ú
startswithÚ__dict__ÚKeyErrorÚAttributeErrorÚendswithr¾rÀÚlistr¿)rWrMÚfrDrDrEÚ __getattr__cs
 
  z_FunctionGenerator.__getattr__rz_TypeEngineArgument[_T]z Function[_T])rUrkÚkwargsrgcOsdSrhrD)rWrkrUrÌrDrDrEÚ__call__qsz_FunctionGenerator.__call__z Function[Any])rUrÌrgcOsdSrhrD)rWrUrÌrDrDrErÍwscOs¨|j ¡}| |¡t|jƒ}|dkr2|j\}}n|dkrLd|jd}}nd}|dk    r|t| | ¡¡}|dk    r||||ŽSt|jdf|ždt    |jdd…ƒi|—ŽS)Nr2r r;rrÃrK)
rÀÚcopyÚupdateÚlenr¿r:Úgetr=ÚFunctionÚtuple)rWrUrÌÚoÚtokensrBÚfnameÚfuncrDrDrErÍ{s*
 
 
 
ÿÿÿÿzType[AnsiFunction[Any]]r‚cCsdSrhrDrVrDrDrEÚ ansifunction˜sz_FunctionGenerator.ansifunctionzType[array_agg[Any]]cCsdSrhrDrVrDrDrEÚ    array_aggœsz_FunctionGenerator.array_aggzType[Cast[Any]]cCsdSrhrDrVrDrDrEr sz_FunctionGenerator.castzType[char_length]cCsdSrhrDrVrDrDrEÚ char_length¤sz_FunctionGenerator.char_lengthzType[coalesce[Any]]cCsdSrhrDrVrDrDrEÚcoalesce¨sz_FunctionGenerator.coalescez Type[concat]cCsdSrhrDrVrDrDrEÚconcat¬sz_FunctionGenerator.concatz Type[count]cCsdSrhrDrVrDrDrEÚcount°sz_FunctionGenerator.countzType[cube[Any]]cCsdSrhrDrVrDrDrEÚcube´sz_FunctionGenerator.cubezType[cume_dist]cCsdSrhrDrVrDrDrEÚ    cume_dist¸sz_FunctionGenerator.cume_distzType[current_date]cCsdSrhrDrVrDrDrEÚ current_date¼sz_FunctionGenerator.current_datezType[current_time]cCsdSrhrDrVrDrDrEÚ current_timeÀsz_FunctionGenerator.current_timezType[current_timestamp]cCsdSrhrDrVrDrDrEÚcurrent_timestampÄsz$_FunctionGenerator.current_timestampzType[current_user]cCsdSrhrDrVrDrDrEÚ current_userÈsz_FunctionGenerator.current_userzType[dense_rank]cCsdSrhrDrVrDrDrEÚ
dense_rankÌsz_FunctionGenerator.dense_rankz Type[Extract]cCsdSrhrDrVrDrDrEÚextractÐsz_FunctionGenerator.extractzType[grouping_sets[Any]]cCsdSrhrDrVrDrDrEÚ grouping_setsÔsz _FunctionGenerator.grouping_setszType[localtime]cCsdSrhrDrVrDrDrEÚ    localtimeØsz_FunctionGenerator.localtimezType[localtimestamp]cCsdSrhrDrVrDrDrEÚlocaltimestampÜsz!_FunctionGenerator.localtimestampzType[max[Any]]cCsdSrhrDrVrDrDrEÚmaxàsz_FunctionGenerator.maxzType[min[Any]]cCsdSrhrDrVrDrDrEÚminäsz_FunctionGenerator.minzType[mode[Any]]cCsdSrhrDrVrDrDrEÚmodeèsz_FunctionGenerator.modezType[next_value]cCsdSrhrDrVrDrDrEÚ
next_valueìsz_FunctionGenerator.next_valuez    Type[now]cCsdSrhrDrVrDrDrEÚnowðsz_FunctionGenerator.nowzType[OrderedSetAgg[Any]]cCsdSrhrDrVrDrDrEÚ orderedsetaggôsz _FunctionGenerator.orderedsetaggzType[percent_rank]cCsdSrhrDrVrDrDrEÚ percent_rankøsz_FunctionGenerator.percent_rankzType[percentile_cont[Any]]cCsdSrhrDrVrDrDrEÚpercentile_contüsz"_FunctionGenerator.percentile_contzType[percentile_disc[Any]]cCsdSrhrDrVrDrDrEÚpercentile_discsz"_FunctionGenerator.percentile_discz Type[random]cCsdSrhrDrVrDrDrEÚrandomsz_FunctionGenerator.randomz
Type[rank]cCsdSrhrDrVrDrDrEÚranksz_FunctionGenerator.rankzType[ReturnTypeFromArgs[Any]]cCsdSrhrDrVrDrDrEÚreturntypefromargs sz%_FunctionGenerator.returntypefromargszType[rollup[Any]]cCsdSrhrDrVrDrDrEÚrollupsz_FunctionGenerator.rollupzType[session_user]cCsdSrhrDrVrDrDrEÚ session_usersz_FunctionGenerator.session_userzType[sum[Any]]cCsdSrhrDrVrDrDrEÚsumsz_FunctionGenerator.sumz Type[sysdate]cCsdSrhrDrVrDrDrEÚsysdatesz_FunctionGenerator.sysdatez
Type[user]cCsdSrhrDrVrDrDrEÚuser sz_FunctionGenerator.userN)-rŸr r¡r¢r_rËrrÍr r¦rØrÙrrÚrÛrÜrÝrÞrßràrárârãrärårærçrèrérêrërìrírîrïrðrñròrórôrõrör÷rørùrDrDrDrEr¾sžVr¾F)Úgroupc@sveZdZUdZdZejdejfdej    fdej
fgZde d<de d<de d<d    d    d
œdd d d dœdd„Z ddd„Z d    S)rÒaáDescribe a named SQL function.
 
    The :class:`.Function` object is typically generated from the
    :data:`.func` generation object.
 
 
    :param \*clauses: list of column expressions that form the arguments
     of the SQL function call.
 
    :param type\_: optional :class:`.TypeEngine` datatype object that will be
     used as the return value of the column expression generated by this
     function call.
 
    :param packagenames: a string which indicates package prefix names
     to be prepended to the function name when the SQL is generated.
     The :data:`.func` generator creates these when it is called using
     dotted format, e.g.::
 
        func.mypackage.some_function(col1, col2)
 
    .. seealso::
 
        :ref:`tutorial_functions` - in the :ref:`unified_tutorial`
 
        :data:`.func` - namespace which produces registered or ad-hoc
        :class:`.Function` instances.
 
        :class:`.GenericFunction` - allows creation of registered function
        types.
 
    ÚfunctionrKrMrqr<r@zTypeEngine[_T]N)rkrKrr¹zOptional[Tuple[str, ...]])rMrLrkrKcGs0|pd|_||_t |¡|_tj|f|žŽdS)z–Construct a :class:`.Function`.
 
        The :data:`.func` construct is normally used to construct
        new :class:`.Function` instances.
 
        rDN)rKrMrrºrqrGr_)rWrMrkrKrLrDrDrEr_ks
 zFunction.__init__cKs t|j|f||j|ddœ|—ŽS)NT)r“r”rkr•)rrMrqr–rDrDrEr˜sþúùzFunction._bind_param)N)rŸr r¡r¢r»rGr¤r1rµZ    dp_stringr¼r¥r_r˜rDrDrDrErÒ-s
 ýûrÒcsZeZdZUdZdZdZded<dZddœ‡fdd„ Ze    d    d
dd œd d „ƒZ
dd„Z ‡Z S)ÚGenericFunctionaqDefine a 'generic' function.
 
    A generic function is a pre-established :class:`.Function`
    class that is instantiated automatically when called
    by name from the :data:`.func` attribute.    Note that
    calling any name from :data:`.func` has the effect that
    a new :class:`.Function` instance is created automatically,
    given that name.  The primary use case for defining
    a :class:`.GenericFunction` class is so that a function
    of a particular name may be given a fixed return type.
    It can also include custom argument parsing schemes as well
    as additional methods.
 
    Subclasses of :class:`.GenericFunction` are automatically
    registered under the name of the class.  For
    example, a user-defined function ``as_utc()`` would
    be available immediately::
 
        from sqlalchemy.sql.functions import GenericFunction
        from sqlalchemy.types import DateTime
 
        class as_utc(GenericFunction):
            type = DateTime()
            inherit_cache = True
 
        print(select(func.as_utc()))
 
    User-defined generic functions can be organized into
    packages by specifying the "package" attribute when defining
    :class:`.GenericFunction`.   Third party libraries
    containing many functions may want to use this in order
    to avoid name conflicts with other systems.   For example,
    if our ``as_utc()`` function were part of a package
    "time"::
 
        class as_utc(GenericFunction):
            type = DateTime()
            package = "time"
            inherit_cache = True
 
    The above function would be available from :data:`.func`
    using the package name ``time``::
 
        print(select(func.time.as_utc()))
 
    A final option is to allow the function to be accessed
    from one name in :data:`.func` but to render as a different name.
    The ``identifier`` attribute will override the name used to
    access the function as loaded from :data:`.func`, but will retain
    the usage of ``name`` as the rendered name::
 
        class GeoBuffer(GenericFunction):
            type = Geometry()
            package = "geo"
            name = "ST_Buffer"
            identifier = "buffer"
            inherit_cache = True
 
    The above function will render as follows:
 
    .. sourcecode:: pycon+sql
 
        >>> print(func.geo.buffer())
        {printsql}ST_Buffer()
 
    The name will be rendered as is, however without quoting unless the name
    contains special characters that require quoting.  To force quoting
    on or off for the name, use the :class:`.sqlalchemy.sql.quoted_name`
    construct::
 
        from sqlalchemy.sql import quoted_name
 
        class GeoBuffer(GenericFunction):
            type = Geometry()
            package = "geo"
            name = quoted_name("ST_Buffer", True)
            identifier = "buffer"
            inherit_cache = True
 
    The above function will render as:
 
    .. sourcecode:: pycon+sql
 
        >>> print(func.geo.buffer())
        {printsql}"ST_Buffer"()
 
    Type parameters for this class as a
    `generic type <https://peps.python.org/pep-0484/#generics>`_ can be passed
    and should match the type seen in a :class:`_engine.Result`. For example::
 
        class as_utc(GenericFunction[datetime.datetime]):
            type = DateTime()
            inherit_cache = True
 
    The above indicates that the following expression returns a ``datetime``
    object::
 
        connection.scalar(select(func.as_utc()))
 
    .. versionadded:: 1.3.13  The :class:`.quoted_name` construct is now
       recognized for quoting when used with the "name" attribute of the
       object, so that quoting can be forced on or off for the function
       name.
 
 
    Tr\Ú    _registerr°r‚cs*tj|jkr| |j|j¡tƒ ¡dSrh)rZ    AnnotatedÚ__mro__Ú_register_generic_functionrŸrÅr`Ú__init_subclass__)ÚclsrbrDrErs z!GenericFunction.__init_subclass__r<zMapping[str, Any])ÚclsnameÚclsdictrgcCsn| d|¡|_}| d|¡|_}| dd¡}d|krB|d|_t|ddƒ|_|jrdt|||ƒnd|_dS)NrMr@rBr;Z__return_type__rýT)rÑrMr@rqrRrýrF)rrrrMr@rBrDrDrErÿs 
z*GenericFunction._register_generic_functioncsx| dd¡}|dkr&‡fdd„|Dƒ}ˆjp2t|ƒˆ_dˆ_tt|tjddœŽƒˆ_t     
| dd¡pnt ˆddƒ¡ˆ_ dS)    NÚ _parsed_argscs"g|]}tjtj|ˆjˆd‘qS©rN©rrPrrQrMrSrVrDrErXsúüz,GenericFunction.__init__.<locals>.<listcomp>rDTrYrkrq) rpr[r\rKr%r rr]rHrrºrRrq)rWr^rÌZ parsed_argsrDrVrEr_s" 
ù    ÿÿÿzGenericFunction.__init__) rŸr r¡r¢Zcoerce_argumentsÚ inherit_cacher¥rMrÚ classmethodrÿr_r§rDrDrbrErüs
krürråc@sDeZdZdZe ¡ZdZdej    fgZ
dd„Z dd„Z e dd„ƒZd    S)
rìaRepresent the 'next value', given a :class:`.Sequence`
    as its single argument.
 
    Compiles into the appropriate function on each backend,
    or will raise NotImplementedError if used on a backend
    that does not provide support for sequences.
 
    ÚsequencecKs8t|tjƒstdƒ‚||_t |jp.t|ddƒ¡|_    dS)Nz0next_value() accepts a Sequence object as input.rq)
r›rÚSequenceÚAssertionErrorr    rrºZ    data_typerRrq)rWÚseqrtrDrDrEr_Isÿþÿznext_value.__init__cKst|tƒo|jj|jjkSrh)r›rìr    rM)rWÚotherrtrDrDrEÚcompareRs
þznext_value.comparecCsgSrhrDrVrDrDrErXsznext_value._from_objectsN)rŸr r¡r¢rÚIntegerrqrMr1Zdp_named_ddl_elementr¤r_rr¦rrDrDrDrErì8s    ÿ    rìc@seZdZdZdZdd„ZdS)Ú AnsiFunctionzEDefine a function in "ansi" format, which doesn't render parenthesis.TcOstj|f|ž|ŽdSrh)rür_)rWr^rÌrDrDrEr_bszAnsiFunction.__init__N)rŸr r¡r¢rr_rDrDrDrEr]srcs$eZdZdZdZ‡fdd„Z‡ZS)ÚReturnTypeFromArgszADefine a function whose return type is the same as its arguments.Tcs<‡fdd„|Dƒ}| dt|ƒ¡||d<tƒj||ŽdS)Ncs"g|]}tjtj|ˆjˆd‘qSrrrSrVrDrErXlsúüz/ReturnTypeFromArgs.__init__.<locals>.<listcomp>rkr)Ú
setdefaultrr`r_)rWr^rÌÚfn_argsrbrVrEr_ks 
ù    zReturnTypeFromArgs.__init__©rŸr r¡r¢rr_r§rDrDrbrErfsrc@seZdZdZdZdS)rÛTN)rŸr r¡r[rrDrDrDrErÛzsrÛc@seZdZdZdZdS)réz!The SQL MAX() aggregate function.TN©rŸr r¡r¢rrDrDrDrErésréc@seZdZdZdZdS)rêz!The SQL MIN() aggregate function.TNrrDrDrDrErê…srêc@seZdZdZdZdS)r÷z!The SQL SUM() aggregate function.TNrrDrDrDrEr÷‹sr÷c@seZdZdZe ¡ZdZdS)rízºThe SQL now() datetime function.
 
    SQLAlchemy dialects will usually render this particular function
    in a backend-specific way, such as rendering it as ``CURRENT_TIMESTAMP``.
 
    TN©rŸr r¡r¢rÚDateTimerqrrDrDrDrErí‘sríc@seZdZdZe ¡ZdZdS)rÜa*The SQL CONCAT() function, which concatenates strings.
 
    E.g.:
 
    .. sourcecode:: pycon+sql
 
        >>> print(select(func.concat('a', 'b')))
        {printsql}SELECT concat(:concat_2, :concat_3) AS concat_1
 
    String concatenation in SQLAlchemy is more commonly available using the
    Python ``+`` operator with string datatypes, which will render a
    backend-specific concatenation operator, such as :
 
    .. sourcecode:: pycon+sql
 
        >>> print(select(literal("a") + "b"))
        {printsql}SELECT :param_1 || :param_2 AS anon_1
 
 
    TN©rŸr r¡r¢rÚStringrqrrDrDrDrErܝsrÜcs,eZdZdZe ¡ZdZ‡fdd„Z‡Z    S)rÚzThe CHAR_LENGTH() SQL function.Tc stƒj|f|ŽdSrh)r`r_)rWÚargrtrbrDrEr_½szchar_length.__init__©
rŸr r¡r¢rrrqrr_r§rDrDrbrErÚ·srÚc@seZdZdZdZdZdS)ròzThe RANDOM() SQL function.TN©rŸr r¡r¢r[rrDrDrDrEròÃsròcs.eZdZdZe ¡ZdZd‡fdd„    Z‡Z    S)rÝa§The ANSI COUNT aggregate function.  With no arguments,
    emits COUNT \*.
 
    E.g.::
 
        from sqlalchemy import func
        from sqlalchemy import select
        from sqlalchemy import table, column
 
        my_table = table('some_table', column('id'))
 
        stmt = select(func.count()).select_from(my_table)
 
    Executing ``stmt`` would emit::
 
        SELECT count(*) AS count_1
        FROM some_table
 
 
    TNc s$|dkrtdƒ}tƒj|f|ŽdS)NÚ*)r&r`r_)rWZ
expressionrÌrbrDrEr_âszcount.__init__)NrrDrDrbrErÝÊsrÝc@seZdZdZe ¡ZdZdS)ràz The CURRENT_DATE() SQL function.TN)rŸr r¡r¢rÚDaterqrrDrDrDrEràèsràc@seZdZdZe ¡ZdZdS)ráz The CURRENT_TIME() SQL function.TN)rŸr r¡r¢rZTimerqrrDrDrDrEráïsrác@seZdZdZe ¡ZdZdS)râz%The CURRENT_TIMESTAMP() SQL function.TNrrDrDrDrErâösrâc@seZdZdZe ¡ZdZdS)rãz The CURRENT_USER() SQL function.TNrrDrDrDrErãýsrãc@seZdZdZe ¡ZdZdS)rçzThe localtime() SQL function.TNrrDrDrDrErçsrçc@seZdZdZe ¡ZdZdS)rèz"The localtimestamp() SQL function.TNrrDrDrDrErè srèc@seZdZdZe ¡ZdZdS)röz The SESSION_USER() SQL function.TNrrDrDrDrErösröc@seZdZdZe ¡ZdZdS)røzThe SYSDATE() SQL function.TNrrDrDrDrErøsrøc@seZdZdZe ¡ZdZdS)rùzThe USER() SQL function.TNrrDrDrDrErù srùcs$eZdZdZdZ‡fdd„Z‡ZS)rÙaSupport for the ARRAY_AGG function.
 
    The ``func.array_agg(expr)`` construct returns an expression of
    type :class:`_types.ARRAY`.
 
    e.g.::
 
        stmt = select(func.array_agg(table.c.values)[2:5])
 
    .. seealso::
 
        :func:`_postgresql.array_agg` - PostgreSQL-specific version that
        returns :class:`_postgresql.ARRAY`, which has PG-specific operators
        added.
 
    Tcsp‡fdd„|Dƒ}| dtj¡}d|krVt|ƒ}t|tjƒrF||d<n||dd|d<||d<tƒj||ŽdS)Ncsg|]}tjtj|ˆd‘qS))rO)rrPrrQrSrVrDrErX<s ýÿz&array_agg.__init__.<locals>.<listcomp>Z_default_array_typerkr )Z
dimensionsr)rprrœrr›r`r_)rWr^rÌrZdefault_array_typeZtype_from_argsrbrVrEr_;s
ü 
ÿ
zarray_agg.__init__rrDrDrbrErÙ'srÙc@s eZdZdZdZdZdd„ZdS)Ú OrderedSetAggz­Define a function where the return type is based on the sort
    expression type as defined by the expression passed to the
    :meth:`.FunctionElement.within_group` method.FTcCsLtt|jjƒ}t |j¡}|jr>t|j    ƒdkr>t
  |dj ¡S|dj SdS)Nr r) rr rHrƒÚsqlutilZunwrap_order_byr…Úarray_for_multi_clauserÐrLrrœrq)rWr‰Z func_clausesr…rDrDrErYs
 zOrderedSetAgg.within_group_typeN)rŸr r¡r¢r!rrrDrDrDrErQsrc@seZdZdZdZdS)rëaImplement the ``mode`` ordered-set aggregate function.
 
    This function must be used with the :meth:`.FunctionElement.within_group`
    modifier to supply a sort expression to operate upon.
 
    The return type of this function is the same as the sort expression.
 
    TNrrDrDrDrErëbs    rëc@seZdZdZdZdZdS)rða|Implement the ``percentile_cont`` ordered-set aggregate function.
 
    This function must be used with the :meth:`.FunctionElement.within_group`
    modifier to supply a sort expression to operate upon.
 
    The return type of this function is the same as the sort expression,
    or if the arguments are an array, an :class:`_types.ARRAY` of the sort
    expression's type.
 
    TN©rŸr r¡r¢r!rrDrDrDrErðos rðc@seZdZdZdZdZdS)rña|Implement the ``percentile_disc`` ordered-set aggregate function.
 
    This function must be used with the :meth:`.FunctionElement.within_group`
    modifier to supply a sort expression to operate upon.
 
    The return type of this function is the same as the sort expression,
    or if the arguments are an array, an :class:`_types.ARRAY` of the sort
    expression's type.
 
    TNr"rDrDrDrErñs rñc@seZdZdZe ¡ZdZdS)róaImplement the ``rank`` hypothetical-set aggregate function.
 
    This function must be used with the :meth:`.FunctionElement.within_group`
    modifier to supply a sort expression to operate upon.
 
    The return type of this function is :class:`.Integer`.
 
    TN©rŸr r¡r¢rrrqrrDrDrDrErós    róc@seZdZdZe ¡ZdZdS)räa Implement the ``dense_rank`` hypothetical-set aggregate function.
 
    This function must be used with the :meth:`.FunctionElement.within_group`
    modifier to supply a sort expression to operate upon.
 
    The return type of this function is :class:`.Integer`.
 
    TNr#rDrDrDrEräs    räc@s&eZdZUdZe ¡Zded<dZdS)rïaImplement the ``percent_rank`` hypothetical-set aggregate function.
 
    This function must be used with the :meth:`.FunctionElement.within_group`
    modifier to supply a sort expression to operate upon.
 
    The return type of this function is :class:`.Numeric`.
 
    ú!sqltypes.Numeric[decimal.Decimal]rqTN©    rŸr r¡r¢rZNumericrqr¥rrDrDrDrErï«s
    rïc@s&eZdZUdZe ¡Zded<dZdS)rßa Implement the ``cume_dist`` hypothetical-set aggregate function.
 
    This function must be used with the :meth:`.FunctionElement.within_group`
    modifier to supply a sort expression to operate upon.
 
    The return type of this function is :class:`.Numeric`.
 
    r$rqTNr%rDrDrDrErß¹s
    rßc@seZdZdZdZdZdS)rÞaSImplement the ``CUBE`` grouping operation.
 
    This function is used as part of the GROUP BY of a statement,
    e.g. :meth:`_expression.Select.group_by`::
 
        stmt = select(
            func.sum(table.c.value), table.c.col_1, table.c.col_2
        ).group_by(func.cube(table.c.col_1, table.c.col_2))
 
    .. versionadded:: 1.2
 
    TNrrDrDrDrErÞÇs rÞc@seZdZdZdZdZdS)rõaWImplement the ``ROLLUP`` grouping operation.
 
    This function is used as part of the GROUP BY of a statement,
    e.g. :meth:`_expression.Select.group_by`::
 
        stmt = select(
            func.sum(table.c.value), table.c.col_1, table.c.col_2
        ).group_by(func.rollup(table.c.col_1, table.c.col_2))
 
    .. versionadded:: 1.2
 
    TNrrDrDrDrErõØs rõc@seZdZdZdZdZdS)ræaImplement the ``GROUPING SETS`` grouping operation.
 
    This function is used as part of the GROUP BY of a statement,
    e.g. :meth:`_expression.Select.group_by`::
 
        stmt = select(
            func.sum(table.c.value), table.c.col_1, table.c.col_2
        ).group_by(func.grouping_sets(table.c.col_1, table.c.col_2))
 
    In order to group by multiple sets, use the :func:`.tuple_` construct::
 
        from sqlalchemy import tuple_
 
        stmt = select(
            func.sum(table.c.value),
            table.c.col_1, table.c.col_2,
            table.c.col_3
        ).group_by(
            func.grouping_sets(
                tuple_(table.c.col_1, table.c.col_2),
                tuple_(table.c.value, table.c.col_3),
            )
        )
 
 
    .. versionadded:: 1.2
 
    TNrrDrDrDrEræésræ)r;)ur¢Ú
__future__rÚdatetimeÚdecimalÚtypingrrrrrrr    r
r r Úrrrrrrrrr Ú_typingrÚbaserrrrrÚelementsrrrrr r!r"r$r%r&r'r)r+Z
selectabler,r-r.r/r0Zvisitorsr1r3Z engine.baser4Z engine.cursorr5Zengine.interfacesr6r7r8Ú defaultdictÚdictr:r¥rFrGr‹rjr¾r×ÚmodifierrÒrürªrìrrrÛrérêr÷rír<rÜrÚÚfloatròrÝÚdateràÚtimerárârãrçrèrörørùrÙrrërðrñróräÚDecimalrïrßrÞrõrærDrDrDrEÚ<module>    sØ                                                   þ
 
Z4!
`(
 
%      *