table().get_schema(name) fails with table (name) not found, search_and_filter().query(table) works

Hey, so here's a snippet of code I'm using
print("Table:", table)
response = self.client.search_and_filter().query(table)
print("Response:", response)
response = self.client.table().get_schema(table)
assert response.is_success(), response
return response
print("Table:", table)
response = self.client.search_and_filter().query(table)
print("Response:", response)
response = self.client.table().get_schema(table)
assert response.is_success(), response
return response
following https://xata-py.readthedocs.io/en/latest/api.html#xata.api.table.Table.get_schema, https://github.com/xataio/xtools/blob/main/xfileindex/localfileindex.py#L79 and anything else I can find. my logs go:
Table: users
2025-01-29 22:49:58 Response: {'meta': {'page': {'cursor': 'yjKsVirOLypRsopWqkgsSYzPTFGK1VFKyywqBosVpSbHJ5emJBoWpBQWZZmZF5fmlCSZWaaDFOUkEqEmMzezRMnKyEBHKS0nMb1YycqglgsQAAD__w', 'more': False, 'size': 20}}, 'records': [{'id': 'rec_cuda1pdqrj67sultb69g', 'xata': {'createdAt': '2025-01-29T21:43:01.846224Z', 'updatedAt': '2025-01-29T21:43:01.846224Z', 'version': 0}}]}

(...)

2025-01-29 22:49:58 assert response.is_success(), response
2025-01-29 22:49:58 ^^^^^^^^^^^^^^^^^^^^^
2025-01-29 22:49:58 AssertionError: {'id': 'cd2d29b4-0569-9f61-833f-d58729c4c6a0', 'message': 'table [EditableChat:dev/users] not found'}
Table: users
2025-01-29 22:49:58 Response: {'meta': {'page': {'cursor': 'yjKsVirOLypRsopWqkgsSYzPTFGK1VFKyywqBosVpSbHJ5emJBoWpBQWZZmZF5fmlCSZWaaDFOUkEqEmMzezRMnKyEBHKS0nMb1YycqglgsQAAD__w', 'more': False, 'size': 20}}, 'records': [{'id': 'rec_cuda1pdqrj67sultb69g', 'xata': {'createdAt': '2025-01-29T21:43:01.846224Z', 'updatedAt': '2025-01-29T21:43:01.846224Z', 'version': 0}}]}

(...)

2025-01-29 22:49:58 assert response.is_success(), response
2025-01-29 22:49:58 ^^^^^^^^^^^^^^^^^^^^^
2025-01-29 22:49:58 AssertionError: {'id': 'cd2d29b4-0569-9f61-833f-d58729c4c6a0', 'message': 'table [EditableChat:dev/users] not found'}
which seems weird, given I just got a query running on that exact table a line earlier. Given one of the errors I run into trying to figure this out there may be an issue with Python SDK interacting with Postgres-ready database, but I can't tell for sure if there's an actual bug or I'm missing something. As far as I can tell it's hitting the same url up to /search vs /schema (https://github.com/xataio/xata-py/blob/main/xata/api/search_and_filter.py#L853 vs https://github.com/xataio/xata-py/blob/main/xata/api/table.py#L148) so... I don't know.
2 Replies
teleoflexuous
teleoflexuousOP4w ago
... I just noticed title suggest I'm using different vairable, but as seen in code, I do not ^^
cmck
cmck4w ago
Let me take a look and see if I can recreate the issue 👍 I was able to recreate this error and I can confirm that get_schema() does not work with a Postgres-enabled database. It does, however, work with a non-Postgres-enabled database.

Did you find this page helpful?