question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: Object of type datetime is not JSON serializable

See original GitHub issue

Hello!

This project is great. I’ve run into an issue though. I was trying to run this (unfinished) query:

select m.id, m.pub_name, m.pub_id, m.contents_restricted, 
	array_agg(s.updated_at) as sub_dates
from main_manuscript m
left join main_submission s on m.id=s.manuscript_id
group by m.id, m.pub_name, m.pub_id, m.contents_restricted
order by m.id

The problem is that django-sql-dashboard errors out because it doesn’t know how to serialize the s.updated_at DateTime field for working with array_agg.

As far as I could tell the only way to fix this would be to fork the codebase? Am I missing something? Thanks!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

0reactions
matthew-a-dunlapcommented, Mar 8, 2022

Awesome! Thanks so much 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to overcome "datetime.datetime not JSON serializable"?
My quick & dirty JSON dump that eats dates and everything: json.dumps(my_dictionary, indent=4, sort_keys=True, default=str). default is a function applied ...
Read more >
TypeError: Object of type datetime is not JSON serializable
The Python TypeError: Object of type datetime is not JSON serializable occurs when we try to convert a `datetime` object to a JSON...
Read more >
Object of Type Datetime Is Not Json Serializable in Python
When we get the object of type datetime is not JSON serializable exception in Python, it means that the datetime object cannot be...
Read more >
Python Serialize Datetime into JSON
Learn how to solve Object of type datetime is not JSON serializable when you try to convert Python datetime into JSON.
Read more >
Object of type datetime is not JSON serializable
Solution 2. Generally, using of json. dumps with a custom converter. By default, it converts everything it doesn't know to a string.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found