google / google/flatbuffers

[Python] `Builder` object has no attribute `CreateVectorOfTables`

Open
#8,940 8 comments 0 reactions 0 assignees View on GitHub
python Release
Dominant language
C++
Stars
26.5k
Forks
3.7k
PR merge metrics
No merged PRs in 30d

Description

Greetings,

I'm having issues with using code generated for the Python language.
Specifically, if I use a nested table in my schema, the following code is generated:
```py
def MyTableCreateValuesVector(builder: flatbuffers.Builder, data: Iterable[Any]) -> int:
return builder.CreateVectorOfTables(data)
```

Unfortunately, when I try to use this method, I get the following error:
```
'Builder' object has no attribute 'CreateVectorOfTables'
```

I'm using FlatBuffers version 25.12.19
```sh
> flatc --version
flatc version 25.12.19
> uv pip show flatbuffers
Name: flatbuffers
Version: 25.12.19
Location: [CWD]/.venv/lib/python3.13/site-packages
Requires:
Required-by: [my-package]
```

## Code generation
You can reproduce the issue with the following schema:
```
namespace Example;

table NestedTable {
value:uint64;
}

table MyTable {
values:[NestedTable];
}

root_type MyTable;
```

I used the following command to generate the code:
```sh
flatc --python --python-typing example.fbs
```

Example script which replicates the issue:
```py
import flatbuffers

import Example.NestedTable
import Example.MyTable

builder = flatbuffers.Builder()

Example.NestedTable.NestedTableStart(builder)
Example.NestedTable.NestedTableAddValue(builder, 10)
nested_table = Example.NestedTable.NestedTableEnd(builder)

nested_table_vector = Example.MyTable.MyTableCreateValuesVector(builder, [nested_table]) # <--- Fails here

Example.MyTable.MyTableStart(builder)
Example.MyTable.MyTableAddValues(builder, nested_table_vector)
my_table = Example.MyTable.MyTableEnd(builder)

builder.Finish(my_table)
```

## Observations
From what I've seen in the repository, it seems like this method is present and all is well.
Unfortunately, when I download the package from PyPI, this method doesn't exist.

Could you please check if you are publishing the correct version of the package?
I looked into recent releases and it seems like this method is missing in all of them.

Manually replacing the `builder.py` file's content with what exists in the repository fixes the issue.

Thanks :3

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.