Skip to content

Commit 7cd6f58

Browse files
committed
feat: Get complex postgres argument components directly.
1 parent 9e31cc3 commit 7cd6f58

File tree

16 files changed

+398
-123
lines changed

16 files changed

+398
-123
lines changed

src/sqlalchemy_declarative_extensions/dialects/mysql/function.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,9 @@ def normalize(self) -> Function:
109109
norm_type = type_map.get(type_str.lower(), type_str.lower())
110110
normalized_parameters.append(f"{name} {norm_type}")
111111
else:
112-
normalized_parameters.append(param) # Keep as is if format unexpected
112+
normalized_parameters.append(
113+
param
114+
) # Keep as is if format unexpected
113115

114116
return replace(
115117
self,

src/sqlalchemy_declarative_extensions/dialects/mysql/query.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def get_functions_mysql(connection: Connection) -> Sequence[BaseFunction]:
9292
functions = []
9393
for f in connection.execute(functions_query, {"schema": database}).fetchall():
9494
parameters = None
95-
if f.parameters: # Parameter string might be None if no parameters
95+
if f.parameters: # Parameter string might be None if no parameters
9696
parameters = [p.strip() for p in f.parameters.split(",")]
9797

9898
functions.append(

src/sqlalchemy_declarative_extensions/dialects/mysql/schema.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,9 @@
8787
select(
8888
column("SPECIFIC_NAME").label("routine_name"),
8989
func.group_concat(
90-
text("concat(PARAMETER_NAME, ' ', DTD_IDENTIFIER) ORDER BY ORDINAL_POSITION SEPARATOR ', '"),
90+
text(
91+
"concat(PARAMETER_NAME, ' ', DTD_IDENTIFIER) ORDER BY ORDINAL_POSITION SEPARATOR ', '"
92+
),
9193
).label("parameters"),
9294
)
9395
.select_from(table("PARAMETERS", schema="INFORMATION_SCHEMA"))
@@ -107,7 +109,7 @@
107109
routine_table.c.sql_data_access.label("data_access"),
108110
parameters_subquery.c.parameters.label("parameters"),
109111
)
110-
.select_from( # Join routines with the parameter subquery
112+
.select_from( # Join routines with the parameter subquery
111113
routine_table.outerjoin(
112114
parameters_subquery,
113115
routine_table.c.routine_name == parameters_subquery.c.routine_name,

src/sqlalchemy_declarative_extensions/dialects/postgresql/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
from sqlalchemy_declarative_extensions.dialects.postgresql.function import (
22
Function,
3+
FunctionParam,
4+
FunctionReturn,
35
FunctionSecurity,
46
FunctionVolatility,
57
)
@@ -43,6 +45,8 @@
4345
"DefaultGrantTypes",
4446
"Function",
4547
"FunctionGrants",
48+
"FunctionParam",
49+
"FunctionReturn",
4650
"FunctionSecurity",
4751
"FunctionVolatility",
4852
"Grant",

0 commit comments

Comments
 (0)