Skip to content

Commit 09ffbc7

Browse files
authored
Merge pull request #44 from zinal/ex_basic-example_p2
basic_example_v1: added comments on TablePathPrefix usage to avoid confusion
2 parents 11a7d87 + 994ec5c commit 09ffbc7

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

examples/basic_example_v1/basic_example.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,17 @@
33
import ydb
44
import basic_example_data
55

6+
# Table path prefix allows to put the working tables into the specific directory
7+
# inside the YDB database. Putting `PRAGMA TablePathPrefix("some/path")`
8+
# at the beginning of the query allows to reference the tables through
9+
# their names "under" the specified directory.
10+
#
11+
# TablePathPrefix can be defined as an absolute path (starting with slash),
12+
# or as a relative path. Absolute path has to be started with the current
13+
# database location.
14+
#
15+
# https://ydb.tech/ru/docs/yql/reference/syntax/pragma#table-path-prefix
16+
617
FillDataQuery = """PRAGMA TablePathPrefix("{}");
718
819
DECLARE $seriesData AS List<Struct<
@@ -309,6 +320,8 @@ def run(endpoint, database, path):
309320

310321
ensure_path_exists(driver, database, path)
311322

323+
# absolute path - prefix to the table's names,
324+
# including the database location
312325
full_path = posixpath.join(database, path)
313326

314327
create_tables(pool, full_path)

0 commit comments

Comments
 (0)