Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: 'no decoder for tag' when querying tables with datetimes #144

Open
2 tasks done
MarcGilbertSparte opened this issue Jan 17, 2025 · 1 comment
Open
2 tasks done
Assignees
Labels
bug Something isn't working

Comments

@MarcGilbertSparte
Copy link

MarcGilbertSparte commented Jan 17, 2025

Describe the bug

I'm trying to get some data from my surreal database but every queries to tables where there are datetimes return ('no decoder for tag', 12)

Steps to reproduce

Here is the python code to reproduce :

async with AsyncSurrealDB(url=SURREAL_ENDPOINT) as db:
    await db.use(SURREAL_NS, SURREAL_DB)
    auth_token = await db.sign_in(username=SURREAL_USER, password=SURREAL_PASSWORD)
    await db.authenticate(auth_token)
    query_result = await db.select("testPy")
    print(query_result)

Here is the table definition :

DEFINE TABLE testPy;
DEFINE FIELD name ON testPy TYPE string;
DEFINE FIELD count ON testPy TYPE int;
DEFINE FIELD user ON testPy TYPE record<user>;
-- Tried first without, then with the date :
DEFINE FIELD date ON testPy TYPE datetime;

Result :

Without FIELD date on testPy TYPE datetime :

[{'count': 0, 'id': RecordID(table_name=testPy, record_id=ccr4bpvioy08bxugmqul), 'name': 'test', 'user': RecordID(table_name=user, record_id=0b07ec636e914488a67c0198fe36ecce)}]

With FIELD date ON testPy TYPE datetime :

('no decoder for tag', 12)
Traceback (most recent call last):
  File "(...)\server.py", line 86, in <module>
    asyncio.run(query())
  File "C:\Python311\Lib\asyncio\runners.py", line 190, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\asyncio\runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\asyncio\base_events.py", line 651, in run_until_complete
    raise RuntimeError('Event loop stopped before Future completed.')
RuntimeError: Event loop stopped before Future completed.

Expected behaviour

The query should return the data.

SurrealDB version

2.1.4 for linux on x86_64

surrealdb.py version

surrealdb.py 0.4.1 for Windows using Python 3.11.3

Contact Details

cto@parte.io

Is there an existing issue for this?

  • I have searched the existing issues

Code of Conduct

  • I agree to follow this project's Code of Conduct
@MarcGilbertSparte MarcGilbertSparte added the bug Something isn't working label Jan 17, 2025
@remade
Copy link
Collaborator

remade commented Jan 24, 2025

Hi @MarcGilbertSparte , this is fixed in #134 and would be part of the next release

@remade remade self-assigned this Jan 24, 2025
@maxwellflitton maxwellflitton mentioned this issue Feb 3, 2025
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants