I'm afraid I can't really help you debug your whole application like
this - I can only try to answer specific questions.
If you haven't already done so, I think it would help you to find a
program to explore the data in your database. Either the psql command
line tool that comes with postgresql,
@MIke
> SQLAlchemy has to know about all the classes before you do a query that's
> going to refer to a remote class' polymorphic_identity, so somewhere you
> have to make sure the module was imported.
>
>
I imported the subclass and indeed now "it works". At first this is counter
On Thu, Jul 4, 2019, at 8:14 AM, natsjoo sodillepa wrote:
> @Simon.
> Interesting point. I create the DB and the instances in one script. The data
> in the db seems to be correct.
> However the error occurs in a second script which almost is like this:
>
> import ClassA2
>
> ... create
it looks like Postgresql 9.5+ has a new function jsonb_set that does this, this
can be used with func. If you aren't on pg9.5 you might have to update the
whole value.
full POC below
from sqlalchemy import Column
from sqlalchemy import create_engine
from sqlalchemy import func
from sqlalchemy
Also, another problem is that multiple reviews do not print out.
On 4/7/19, 5:25 PM, "Simon King" wrote:
The corrupted value is in the "reviews" table. Are you populating that
from a CSV file as well? If so, please show the code.
As for fixing the other problem, I don't really
@Simon.
Interesting point. I create the DB and the instances in one script. The
data in the db seems to be correct.
However the error occurs in a second script which almost is like this:
import ClassA2
... create session ...
objectA2 = session.query(ClassA2).first()
for objectA1 in
Here's my entire code. Some parts I messed up the get and post methods, will
work on that later on. Erm... how do I split the list without breaking up the
review then? Or in the first place, is check_for_review a list of dictionaries?
Cravan
On 4/7/19, 5:25 PM, "Simon King" wrote:
The
Hi , I have below jsonb blob which i wanted to update subset value.
{
"preference": {
"android": {
"software_update": "true",
"system_maintenance": "true"
},
"ios": {
"software_update": "true",
"system_maintenance": "true"
}
}
}
how to i update only
SQLAlchemy doesn't care if your classes are defined in a single file
or multiple files.
When you got the error, is it possible that you hadn't imported
moduleB? If you haven't imported it, SQLAlchemy will have no idea that
ClassB exists.
Simon
On Thu, Jul 4, 2019 at 11:53 AM natsjoo sodillepa
Hi all,
I got an "No such polymorphic_identity" error in the following situation:
- I use Declerative and joined table polymorfism style
- moduleA defines Base, and a lot of Classes, one of them ClassA1(Base) and
ClassA2(Base)
- moduleB contains a subclassed ClassB(ClassA1)
- ClassA2 contains a
I would first figure out how you would do this in SQL, and then
translate that to SQLAlchemy. In this case, the EXISTS operator might
work:
SELECT *
FROM department
WHERE EXISTS (
SELECT 1
FROM employee
WHERE employee.department_id = department.id
AND employee.name IN (...)
)
Using ORM querying what is the best practice for limiting the output to a
given number of resulting *entities*?
Consider this model:
from sqlalchemy import Column, DateTime, String, Integer, ForeignKey, func
from sqlalchemy.orm import relationship, backref
from sqlalchemy.ext.declarative import
The corrupted value is in the "reviews" table. Are you populating that
from a CSV file as well? If so, please show the code.
As for fixing the other problem, I don't really understand what the
code is trying to do, so I can't give you an exact solution. But let's
have a look in more detail:
13 matches
Mail list logo