Skip to main content

All Questions

Tagged with
2 votes
1 answer
131 views

Pandas / Polars: Write list of JSONs to Database fails with `ndarray is not json serializable`

I have multiple json columns which I concat to an array of json columns. The DataFarme looks like this ┌─────────────────────────────────┐ │ json_concat │ │ --- ...
SysRIP's user avatar
  • 471
0 votes
0 answers
12 views

I can't upgrade JSON field in my db model [duplicate]

I am using flask-sqlalchemy with sqlite3 and I can't upgrade a json field, model: class User(db.Model, UserMixin): id = db.Column(db.Integer, primary_key=True) username = db.Column(db.String(...
Youssef Ahmedw's user avatar
1 vote
2 answers
67 views

How to check if key is in JSON sqlachemy

I am trying to select a segment if: settings dict is not null Has key user_parameters in it And user_parameters (dict) has key user_id in it Code below: user_id = '100952' select([self.db.segments])....
user16965639's user avatar
0 votes
0 answers
238 views

Why doesn't SQLAlchemy recognize type JSON for this column?

Using SQLAlchemy to interact with Google BigQuery in Python to manage tables that contain JSON fields I get warnings about unrecognized JSON types. from sqlalchemy import create_engine from sqlalchemy....
the_big_blackbox's user avatar
1 vote
1 answer
73 views

Snowflake SQLAlchemy - Dynamically created column with Timestamp?

This is a follow-up question to my previous one. Snowflake SQLAlchemy - Create table with Timestamp? I am dynamically creating columns and I have this schema. I need the "my_time_stamp" ...
MountainBiker's user avatar
0 votes
0 answers
137 views

Sqlalchemy joinedload do not load child if not used

I have this problem, I'm building a backend in fastapi with sqlalchemy and a postgres database. I created this endpoint, but the joinedload does not return the indicated fields. @router.get("/...
Federico Raffoni's user avatar
2 votes
1 answer
3k views

sqlalchemy model to json

I am making an API for communication between front and back ends, on the server side i have python getting sqlalchemy models to send them back, the problem is i can't find a way to convert them to ...
user avatar
0 votes
2 answers
269 views

Filtering by JSON type field with Postgres and SQLAlchemy

I have a table test_table: Column | Type | ------------+------------------------+ id | integer | attributes | json | With content: ...
Duncan's user avatar
  • 257
0 votes
1 answer
189 views

How to send a list of objects from Flask to React

I know similar questions have been asked and answered before but somehow none of those solutions worked for me. I have the following query: results = ( db.session(TestInfo.test, TestInfo....
Waleed Ahmad's user avatar
3 votes
2 answers
2k views

How to create a custom JSON mapping for nested (data)classes with SQLAlchemy (2)

I want to persist a python (data)class (i.e. Person) using imperative mapping in SQLAlchemy. One field of this class refers to another class (City). The second class is only a wrapper around two dicts ...
moe's user avatar
  • 1,806
2 votes
1 answer
3k views

Generate SQLAlchemy models from Pydantic models

So I have this large JSON dataset with a huge number of properties (as well as nested objects). I have used datamodel-code-generator to build pydantic models. The JSON data has been imported into ...
masroore's user avatar
  • 10.1k
1 vote
1 answer
135 views

How to turn off sqlite json query with JSON_QUOTE? There are different between SQLAlchemy's sqlite and mysql json query

Common code from sqlalchemy.orm import sessionmaker from sqlalchemy.ext.declarative import declarative_base from sqlalchemy import create_engine, Column, Integer, JSON Base = declarative_base() class ...
XerCis's user avatar
  • 1,117
34 votes
3 answers
21k views

What is correct mapped annotation for `JSON` in SQLAlchemy 2.x version?

The new version of SQLAlchemy introduced the ability to use type annotations using Mapped[Type] (link). My question is, what should we use as an annotation for sqlalchemy.types.JSON? Is just dict will ...
May Flower's user avatar
0 votes
1 answer
169 views

Json field truncated in sqlalchemy

I am getting my data from my postgres database but it is truncated. For VARCHAR, I know it's possible to set the max size but is it possible to do it too with JSON, or is there an other way? Here is ...
David Bensoussan's user avatar
3 votes
3 answers
892 views

Python sqlAlchemy bulk update but non-serializable JSON attributes

I am trying to better understand how I can bulk update rows in sqlAlchemy using a Python function for each row that requires dumping results to json without having to iterate over them individually: ...
DarkDrassher34's user avatar

15 30 50 per page
1
2 3 4 5
12