Skip to content

Commit ead9f0f

Browse files
authored
Merge pull request #5400 from acirtep/fix/fix-5372
fix: add param details to Python rel API definition
2 parents 614adef + 52a1ab9 commit ead9f0f

File tree

2 files changed

+79
-0
lines changed

2 files changed

+79
-0
lines changed

β€Ždocs/preview/clients/python/relational_api.mdβ€Ž

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1355,6 +1355,15 @@ query(self: duckdb.duckdb.DuckDBPyRelation, virtual_table_name: str, sql_query:
13551355

13561356
Run the given SQL query in sql_query on the view named virtual_table_name that refers to the relation object
13571357

1358+
##### Parameters
1359+
1360+
- **virtual_table_name** : str
1361+
1362+
The name to assign to the current relation when referenced in the SQL query.
1363+
- **sql_query** : str
1364+
1365+
The SQL query string that uses the virtual table name to query the relation.
1366+
13581367
##### Example
13591368

13601369
```python
@@ -1406,6 +1415,12 @@ set_alias(self: duckdb.duckdb.DuckDBPyRelation, alias: str) -> duckdb.duckdb.Duc
14061415

14071416
Rename the relation object to new alias
14081417

1418+
##### Parameters
1419+
1420+
- **alias** : str
1421+
1422+
The alias name to assign to the relation.
1423+
14091424
##### Example
14101425

14111426
```python
@@ -1482,6 +1497,24 @@ show(self: duckdb.duckdb.DuckDBPyRelation, *, max_width: typing.Optional[int] =
14821497

14831498
Display a summary of the data
14841499

1500+
##### Parameters
1501+
1502+
- **max_width** : int
1503+
1504+
Maximum display width for the entire output in characters.
1505+
- **max_rows** : int
1506+
1507+
Maximum number of rows to display.
1508+
- **max_col_width** : int
1509+
1510+
Maximum number of characters to display per column.
1511+
- **null_value** : str
1512+
1513+
String to display in place of NULL values.
1514+
- **render_mode** : object
1515+
1516+
Render mode for displaying the output.
1517+
14851518
##### Example
14861519

14871520
```python

β€Žscripts/generate_python_relational_docs_details.pyβ€Ž

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1179,10 +1179,29 @@ class PythonRelAPIDetails:
11791179
β”‚ created_timestamp β”‚ TIMESTAMP WITH TIME ZONE β”‚ YES β”‚ NULL β”‚ NULL β”‚ NULL β”‚
11801180
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
11811181
""",
1182+
parameters=[
1183+
PythonRelAPIParamDetails(
1184+
parameter_name="virtual_table_name",
1185+
parameter_type=["str"],
1186+
parameter_description="The name to assign to the current relation when referenced in the SQL query.",
1187+
),
1188+
PythonRelAPIParamDetails(
1189+
parameter_name="sql_query",
1190+
parameter_type=["str"],
1191+
parameter_description="The SQL query string that uses the virtual table name to query the relation.",
1192+
),
1193+
],
11821194
),
11831195
'set_alias': PythonRelAPIDetails(
11841196
example="rel.set_alias('abc').select('abc.id')",
11851197
result='In the SQL query, the alias will be `abc`',
1198+
parameters=[
1199+
PythonRelAPIParamDetails(
1200+
parameter_name="alias",
1201+
parameter_type=["str"],
1202+
parameter_description="The alias name to assign to the relation.",
1203+
)
1204+
],
11861205
),
11871206
'alias': PythonRelAPIDetails(
11881207
example='rel.alias', result='unnamed_relation_43c808c247431be5'
@@ -1206,6 +1225,33 @@ class PythonRelAPIDetails:
12061225
β”‚ 08fdcbf8-4e53-4290-9e81-423af263b518 β”‚ value is uneven β”‚ 9 β”‚ 2025-04-09 15:49:20.642+02 β”‚
12071226
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
12081227
""",
1228+
parameters=[
1229+
PythonRelAPIParamDetails(
1230+
parameter_name="max_width",
1231+
parameter_type=["int"],
1232+
parameter_description="Maximum display width for the entire output in characters.",
1233+
),
1234+
PythonRelAPIParamDetails(
1235+
parameter_name="max_rows",
1236+
parameter_type=["int"],
1237+
parameter_description="Maximum number of rows to display.",
1238+
),
1239+
PythonRelAPIParamDetails(
1240+
parameter_name="max_col_width",
1241+
parameter_type=["int"],
1242+
parameter_description="Maximum number of characters to display per column.",
1243+
),
1244+
PythonRelAPIParamDetails(
1245+
parameter_name="null_value",
1246+
parameter_type=["str"],
1247+
parameter_description="String to display in place of NULL values.",
1248+
),
1249+
PythonRelAPIParamDetails(
1250+
parameter_name="render_mode",
1251+
parameter_type=["object"],
1252+
parameter_description="Render mode for displaying the output.",
1253+
),
1254+
],
12091255
),
12101256
'sql_query': PythonRelAPIDetails(
12111257
example='rel.sql_query()',

0 commit comments

Comments
Β (0)