func.sum" to calculate a sum over the related rows. For
your purposes, you probably want "func.avg" to calculate the mean.
(Note that the performance of this query is going to get worse as the
number of products and ratings increases)
Hope that helps,
Simon
On Sun, Oct 29, 2023 a
, the preferred form is:
from sqlalchemy.orm import DeclarativeBase
class Base(DeclarativeBase):
pass
The new approach works better with type-analysis tools like mypy.
https://docs.sqlalchemy.org/en/20/changelog/whatsnew_20.html#whatsnew-20-orm-declarative-typing
Hope that helps,
Simon
(with Alembic for migrations as the schema
changed over time). SQLAlchemy also gives a certain amount of independence
from the underlying database, meaning that I can run most of my tests using
SQLite despite using Postgres or MySQL in production.
In summary: use the right tool for the job :-)
Simon
to be able to use the event hook to add a loader criteria option
targeting the appropriate translation.
Simon
On Tue, Apr 11, 2023 at 5:13 PM Nishant Varma
wrote:
> Hello,
>
> I have this schema:
>
> class Question(Base):
> __tablename__ = "question"
> idn = C
instances = dbsession.query(*models).filter(*conditions).first()
instancedict = {i.__table__.name: i for i in instances}
Hope that helps,
Simon
On Thu, Jan 26, 2023 at 3:05 PM Shuba wrote:
> Hi!
> I have a web application whose main feature is to query 13 different
> database tables whe
the unreleased version of sqlalchemy-utils, or
downgrade SQLAlchemy to a non-beta version.
Hope that helps,
Simon
On Fri, Nov 4, 2022 at 11:22 PM 'Theo Chitayat' via sqlalchemy <
sqlalchemy@googlegroups.com> wrote:
> I have a model that uses ChoiceType like an enum for my FastAPI app.
I can't see anything obviously wrong with your code. If you turn on debug
logs, you'll be able to see the SQL that is being executed, and the rows
that are coming back. Paste those logs here and maybe we'll be able to help
more.
Simon
On Tue, Oct 25, 2022 at 2:38 PM Abdellah ALAOUI ISMAILI
for those tags?
Simon
On Sat, Oct 22, 2022 at 3:37 PM Abdellah ALAOUI ISMAILI <
my.alaoui...@gmail.com> wrote:
> wheel ... in my template, I get just the first tag color, returned from
> the function.
>
> this is the result of my HTML file source code :
>
>
>
utput from the template?
Simon
On Thu, Oct 20, 2022 at 9:05 AM Abdellah ALAOUI ISMAILI <
my.alaoui...@gmail.com> wrote:
> Hello,
> I call a function in my template that returns sqlalchemy query result,
> (color value from the name of the tag). this is the query function :
&g
of the comparator_factory is to add class-level behaviour when
you are building SQL expressions. In this case, you could write a query
like this:
query = dbsession.query(Vertex).filter(Vertex.start > Point(2, 2))
Hope that helps,
Simon
On Fri, Sep 16, 2022 at 9:38 AM jens.t...@gmail.com
wr
alenv, by using an absolute
path.
Hope that helps,
Simon
On Tue, Jun 14, 2022 at 5:32 PM Javier Garcia wrote:
> This is what I'm getting when I try to upgrade to 3.0.0b3.
>
> (venv) jgarcia@Javier-PC:/var/www$ sudo pip install sqlacodegen==3.0
> ERROR: Could not find a version th
Based on the CHANGES file, it looks like --generator is a new option in
v3.0.0:
https://github.com/agronholm/sqlacodegen/blob/master/CHANGES.rst
Simon
On Tue, Jun 14, 2022 at 5:06 PM Javier Garcia wrote:
> Hi,
>
> I have tried to run something like this:
>
> sqlacodegen --g
How many rows are you fetching, and how many columns in each row?
On Thu, Jun 9, 2022 at 8:37 AM Trainer Go wrote:
> Hello Jonathan,
>
> i already executed the query without using pandas in my programm
>
> query = "SELECT"
> for row in conn.execute(query).fetchall():
> pass
>
> the result
print("Returning %s" % result)
return result
Use that hook in your env.py and regenerate your migration script. You
should see output for each object in the database.
Simon
On Wed, Jun 8, 2022 at 5:59 PM Vishal Shimpi
wrote:
> Thank you Simon for your response. yes i am usin
Names from the Autogenerate
Process") is probably what you want.
Hope that helps,
Simon
On Wed, Jun 8, 2022 at 3:15 PM Vishal Shimpi
wrote:
> I am working on fastapi, in which i have created models and i am inteded
> to create the table in sql server database, however when i am runing
and pass the environment name on the command line:
https://alembic.sqlalchemy.org/en/latest/api/runtime.html#alembic.runtime.environment.EnvironmentContext.get_x_argument
Hope that helps,
Simon
On Mon, May 9, 2022 at 8:57 PM thavha tsiwana
wrote:
> wondering if there is more cleare
new_obj to both of them, which
is going to be a problem.
If it were me, I would explicitly pass the session to the move_to_error
method. If you don't like that, you can also use
sqlalchemy.orm.object_session to get the session that new_obj already
belongs to.
Hope that helps,
Simon
On Fri, Apr
I think it should work if you join to the *relationship* explicitly
ie.
session.query(User).join(User.user_groups).filter(...)
Hope that helps,
Simon
On Tue, Apr 5, 2022 at 9:48 PM Jason Hoppes
wrote:
> I want to select all users in a particular group. I have a users table,
> user_
conn1:
do_connect
cargs: []
cparams: {'host': 'db', 'db': 'db', 'user': 'user', 'passwd': 'correct',
'client_flag': 2}
conn2:
As you can hopefully see, the first connection attempt triggered an
exception. The correct password was then stored in cparams, and the next
time we called engine.co
call to the handler will contain the new value.
If each task invocation is creating a new engine using a connection
string that is out of date, then none of that will help you, but that
would be an Airflow problem, not an SQLAlchemy problem.
Simon
On Mon, Mar 21, 2022 at 8:27 PM Srinu Chp wrote:
&
["password"] = get_new_password()
return cx_Oracle.connect(*args, **cparams)
Hope that helps,
Simon
On Mon, Mar 21, 2022 at 4:26 PM Srinu Chp wrote:
>
> Hello Simon,
>
> Thank you for prompt response. I really appreciate your help. I am trying to
> achieve password rota
r
"do_connect" event, and so on. I'm surprised the application gets as
far as it does. Maybe the exception handler inside receive_do_connect
is allowing it to stumble on.
Simon
On Mon, Mar 21, 2022 at 4:51 AM Srinu Chp wrote:
>
> Hello Team,
>
> I tried to create a stand
the instance from the database itself, or
b) Send simpler (non-SQLAlchemy) objects to the worker,
Hope that helps,
Simon
On Wed, Mar 16, 2022 at 2:34 AM Haris Damara wrote:
>
> Hi,
>
> Please help.
>
> Find issue with error message "None! Can't pickle 'sqlalchemy.orm.session.Sessi
/en/14/orm/loading_relationships.html#using-contains-eager-to-load-a-custom-filtered-collection-result
Hope that helps,
Simon
On Wed, Feb 23, 2022 at 5:19 PM shuhari2020 wrote:
>
> FROM:
> https://stackoverflow.com/questions/71225408/issue-translating-raw-sql-to-sqlalchemy-orm-query
>
> I have the fo
ike this:
https://docs.sqlalchemy.org/en/14/orm/mapping_styles.html#imperative-a-k-a-classical-mappings
import sqlalchemy.orm as asorm
mapper_registry = saorm.registry(metadata)
class Res:
pass
mapper_registry.map_imperatively(Res, res_table)
# Now Res will have properties fo
Before we do that, you said that you tried pandas dataframe.to_sql but
it didn't work - can you explain what you mean? Did it raise an error,
or produce the wrong result, or something else?
Simon
On Wed, Feb 23, 2022 at 9:13 PM janio mendonca junior
wrote:
>
> Hi Simon,
>
> Thank
/tutorial.html#executing-multiple-statements
Hope that helps,
Simon
On Wed, Feb 23, 2022 at 8:42 PM janio mendonca junior
wrote:
>
> Hi all,
>
> I have a inquiry from my job to create 2 tables related one-to-one and insert
> some rows on the table. I have a .CSV with the data dictionary
attributes
foreground = "#000"
background = "#fff"
Now every BLPart instance will have "foreground" and "background"
attributes with those values.
If you need something more complicated than that, let us know how you
would want to use them.
Hope that hel
Never mind. This problem is solved by join operations.
Thanks for your attention.
On Friday, January 28, 2022 at 4:16:05 AM UTC+13 Simon King wrote:
> I'm sorry, I still don't understand - what do you expect
> query(Genome.attributes) to do? Can you give an example?
>
> Thank
I'm sorry, I still don't understand - what do you expect
query(Genome.attributes) to do? Can you give an example?
Thanks,
Simon
On Wed, Jan 26, 2022 at 11:30 PM Simon wrote:
>
> Sorry for that the question is not clear. The question is how can we query a
> database's property.
understand what you are trying to do with it.
Thanks,
Simon
On Mon, Jan 24, 2022 at 2:03 AM Simon wrote:
>
> Hi there,
>
> I got a problem about 'sqlalchemy.exc.ArgumentError: SQL expression object
> expected, got object of type instead'
>
> My SQLAlchemy version is 1.3.22. I
Hi there,
I got a problem about 'sqlalchemy.exc.ArgumentError: SQL expression object
expected, got object of type instead'
My SQLAlchemy version is 1.3.22. I have a database like
Class Genome:
id = Column(Integer, primary_key=True)
created_date = Column(Datetime, nullable=False)
age_symbol", does it show the primary key and/or unique index?
Simon
On Tue, Dec 7, 2021 at 10:27 PM Chaozy Z wrote:
>
> I also tried to add unique=True to the column message_id but still fail with
> the same error
>
> On Tuesday, 7 December 2021 at 22:21:49 UTC Chaozy Z wrote:
>&
You ought to be able to use the "sqlalchemy.func" system:
https://docs.sqlalchemy.org/en/14/core/tutorial.html#functions
server_default=sa.func.gen_random_uuid()
Hope that helps,
Simon
On Fri, Nov 19, 2021 at 6:21 AM jens.t...@gmail.com
wrote:
>
> Tim,
>
> I want
rator.has_key
https://github.com/sqlalchemy/sqlalchemy/blob/main/lib/sqlalchemy/dialects/postgresql/json.py#L33
Simon
On Mon, Oct 18, 2021 at 10:35 PM Jonathan Vanasco wrote:
>
> I'm not sure, but AFAIK, this type of search isn't *easily* doable in
> PostgreSQL. The json and json
this:
ranges = [(18, 25), (40, 55), (60, 70)]
conditions = [User.age.between(lower, upper) for (lower, upper) in ranges]
condition = sqlalchemy.or_(*conditions)
users = session.query(User).filter(condition).all()
Hope that helps,
Simon
On Tue, Aug 31, 2021 at 10:07 AM chat...@gmail.com wrote:
.text)
)
# Note that this only outputs Info objects that have at least one
# text object associated with them. If you want to include Info
# objects without a related Text object, change the
# ".join(Info.text)" to ".outerjoin(Info.text)"
for (info, text)
an "AttributeEvents.set" listener for each one.
This should flag the error when a bytestring is assigned to a mapped
attribute.
Hope that helps,
Simon
On Fri, Jul 30, 2021 at 5:10 PM 'Jonathan Vanasco' via sqlalchemy
wrote:
>
> Mike, thanks for replying but go back to vacation.
>
> Anyone el
/events.html#sqlalchemy.orm.MapperEvents.before_update
Hope that helps,
Simon
On Sun, Jun 20, 2021 at 5:37 PM peizhi qin wrote:
>
> I have a table ,the definition is as follows:
> class TEnterprise(Base):
> __tablename__ = 't_enterprise'
> __table_args__ = (
> {'mysql_engine': 'InnoD
tion”, which was
essentially a block that would prevent the Session.commit() method
from actually committing.
"""
Simon
On Sat, Jun 19, 2021 at 4:27 PM kaboo HD wrote:
>
>
> I am trying to test an endpoint in flask and I need to "refresh" the DB after
> some comm
unction
Hope that helps,
Simon
--
SQLAlchemy -
The Python SQL Toolkit and Object Relational Mapper
http://www.sqlalchemy.org/
To post example code, please provide an MCVE: Minimal, Complete, and Verifiable
Example. See http://stackoverflow.com/help/mcve for a full description.
---
You recei
Thanks Mike, I'll see what I can do.
Simon
On Wed, Jun 16, 2021 at 1:26 PM Mike Bayer wrote:
>
> HI Simon -
>
> I believe that example for now should vendor its own "copy()" function that
> does what's needed. the function that's there is already un-doing some of
&
deprecated)
Thanks a lot,
Simon
--
SQLAlchemy -
The Python SQL Toolkit and Object Relational Mapper
http://www.sqlalchemy.org/
To post example code, please provide an MCVE: Minimal, Complete, and Verifiable
Example. See http://stackoverflow.com/help/mcve for a full description.
---
Yo
You can see the archives at https://groups.google.com/g/sqlalchemy to
get an idea of the traffic.
Simon
On Mon, Jun 14, 2021 at 10:25 PM Rich Shepard wrote:
>
> I've not worked with SQLAlchemy for several years but now want to use it in
> a couple of applications. I've not seen
You can use the "op" method:
https://docs.sqlalchemy.org/en/14/core/sqlelement.html#sqlalchemy.sql.expression.Operators.op
some_column.op("||")(other_column)
Hope that helps,
Simon
On Mon, May 24, 2021 at 4:12 PM Massimiliano della Rovere
wrote:
>
> In postgresql t
o postprocess the query
results in python instead, like this:
a = session.query(GeneralBeqReq)\
.filter(GeneralBeqReq.c.BeqReqStatus == 1)\
.all()
a = [obj for obj in a if obj.is_id_valid]
Simon
On Wed, May 5, 2021 at 4:28 PM Yaakov Bressler wrote:
>
> Query w
the sort of validation that is_id_valid needs to
do, we might be able to help more.
Simon
On Wed, Apr 28, 2021 at 6:33 AM Gyanaranjan Nayak wrote:
>
> I have a function with name is_id_valid(id) which returns either True or
> False.
>
> I want to pass this function inside a s
I probably wouldn't use this:
if test_type == ChildClass1().typ_id:
...simply because creating an instance of the object just to get
access to the typ_id seems like a waste of effort. If you really need
to check integer typ_id values, the staticmethod approach seems fine.
Simon
On Mon, Apr
ektTyp(id=2, name="child1")
child1 = ChildObjekt1(text="child 1 text")
child2 = ChildObjekt2(text="child 2 text")
session.add_all([child1type, child2type, child1, child2])
session.flush()
for obj in session.query(Objekt):
print(obj)
Simon
O
typ_id
}
And this in the subclass:
__mapper_args__ = {
'polymorphic_identity': 7,
}
...and you should get rid of the typ_id function and the
"Objekt.typ_id = ChildClass.typ_id" line.
Does that work for you?
Simon
On Mon, Apr 12, 2021 at 5:18 PM 'Sören Textor' via sqlalchemy
n_history and the
process_history tables, and that the "accountable" column is set
correctly.
I hope that makes sense,
Simon
On Wed, Mar 24, 2021 at 2:25 PM JPLaverdure wrote:
>
> Hi Simon,
>
> Thanks for pointing out the collision, it kinda flew under the radar !
> I renamed the co
which can't work.
If you use a different column name to store the user in the history
table, does the warning go away?
Simon
On Tue, Mar 23, 2021 at 7:17 PM JPLaverdure wrote:
>
> It seems I lost my previous email.. Here it is again:
>
> Sure !
> Here are 2 classes for which th
;
> Thanks !!
> On Monday, March 15, 2021 at 4:33:40 p.m. UTC-4 Jonathan Vanasco wrote:
>>
>> Going beyond what Simon did..
>>
>> I typically make make a table like `user_transaction`, which has all of the
>> relevant information for the transa
ble.insert().values(**tablo)
db.session.execute(insert)
Simon
On Wed, Mar 17, 2021 at 4:19 PM FURKAN bilgin wrote:
>
> I updated sqlalchemy and now I get an error when accessing the database. And
> their codes need to be coded:
> What I really wanted to do was add data to
I assumed you were defining classes corresponding to your database
tables, as shown here:
https://docs.sqlalchemy.org/en/14/orm/tutorial.html#declare-a-mapping
If that's not how you're using SQLAlchemy, you'll have to show your code.
Simon
On Wed, Mar 17, 2021 at 2:07 PM FURKAN bilgin wrote
classes[name]
Another option could be to iterate over Base.__subclasses__:
def get_table_by_name(name):
for cls in Base.__subclasses__():
if cls.__name__ == name:
return cls
Hope that helps,
Simon
On Tue, Mar 16, 2021 at 7:14 PM FURKAN bilgin wrote
/en/13/orm/session_api.html#sqlalchemy.orm.session.Session.info
Then, in the before_flush event handler, I retrieve the request object
from session.info, and then I can add whatever request-specific info I
want to the DB.
Simon
On Sun, Mar 14, 2021 at 4:05 PM JPLaverdure wrote:
>
> Hi E
Student("Name3", "Sname3", clazz=clazz, code='cc7')
]
You are creating an instance of "school.Class", which is the
non-sqlalchemy base class. You probably meant to create an instance of
"Class", which is the SQLAlchemy-mapped subclass, didn't
e to print a stack trace) to find out where
in your code you are adding this object to the session.
Hope that helps,
Simon
On Fri, Mar 12, 2021 at 4:17 AM Advanced Spectrum
wrote:
>
> I have a Base class like this:
>
> class FlagTable(Base):
>
> __tablename__ = "FLAG_TABL
To get zsh to not treat it as a pattern, enclose it in quotes:
pip install 'sqlalcodegen[citext]'
Hope that helps,
Simon
On Mon, Feb 15, 2021 at 12:38 PM Wilfried L. Bounsi wrote:
>
> Hello,
>
> I've been trying to enable citext support by following the installation
&g
is not expecting to be loaded from
a zip file at all, so you might have to find a different way of
packaging it for the Amazon environment. As you suspected, it's not an
SQLAlchemy question any more.
Good luck!
Simon
On Thu, Feb 4, 2021 at 10:43 AM Anhelina Rudkovska
wrote:
>
> Thanks
ment this as a hybrid property on
Parent, where the "expression" part of the hybrid property constructs
a subquery with a union or a join of all the child tables. It'll be
pretty messy, and might not perform particularly well.
Simon
On Wed, Feb 3, 2021 at 10:08 AM Mehrdad Pedramfar
wro
.dist-info" (or possible .egg-info) in
your site-packages. The directory would contain an entry_points.txt
file that points to the dialect class.
Does your site-packages.zip contain that dist info directory with the
entry_points file inside?
Simon
On Mon, Feb 1, 2021 at 4:50 PM Anhelina Rudkov
the associated relationship to be updated immediately:
https://docs.sqlalchemy.org/en/13/faq/sessions.html#i-set-the-foo-id-attribute-on-my-instance-to-7-but-the-foo-attribute-is-still-none-shouldn-t-it-have-loaded-foo-with-id-7
Hope that helps,
Simon
On Mon, Dec 14, 2020 at 12:50 PM João Miguel Neves
priate SQL.
The column_property mechanism accepts a ClauseElement and causes it to
be added to the SQL when you later query the table.
Simon
On Fri, Dec 11, 2020 at 11:11 AM Jinghui Niu wrote:
>
> Thanks. One thing to clarify, I noticed that here you used `case` without
> using in a
aggr = column_property(
case([(attr_a == 'go', attr_b + attr_c)],
else_=attr_b - attr_c)
)
Hope that helps,
Simon
On Fri, Dec 11, 2020 at 9:13 AM niuji...@gmail.com wrote:
>
> I have a mapped class:
>
> class Model(sqlalchemy.declarative_base()):
> attr_a
I can't see anything obviously wrong with what you've written (you
said "child.id is None", but I assume you meant child.parent_id). Can
you provide a runnable example?
Simon
On Thu, Dec 10, 2020 at 8:27 AM Nikola Radovanovic wrote:
>
> Hi,
> I have a FK in child pointing to
of
typeDict, either by re-querying from the database, or by using
session.merge with load=False.
Hope that helps,
Simon
On Thu, Nov 19, 2020 at 11:16 PM Vinit Shah wrote:
>
> I posted this on StackOverflow a few days ago, but I haven't been able to
> figure this one out yet. The orig
goods_child_sizes table)
Simon
On Thu, Oct 22, 2020 at 2:41 PM Padam Sethia wrote:
>>
>>
>> class FinishedGoodsChild(TimestampMixin, db.Model):
>>
>> id = db.Column(db.Integer, primary_key=True)
>>
>> hold_qty = db.Column(db.Float, default=0)
>
You don't need to add a parent_id column, you just need to write the
full relationship condition inside that "select" statement. It would
be much easier to explain if you can show your actual parent and child
classes, including the relationship between them and the association
tab
.\
label('balance')
You probably need something a bit more complicated than that - I
didn't understand the join condition between parent and child in your
example so I made up the "parent_id" column.
Hope that helps,
Simon
On Tue, Oct 20, 2020 at 4:57 PM Padam
Yep, I misunderstood what setinputsizes was doing. I thought it told
pyodbc how it should handle a particular datatype, rather than telling
it how to handle the set of parameters it is about receive in the next
execute() call...
Sorry for adding to the confusion,
Simon
On Fri, Oct 16, 2020 at 1
e.
If you can restrict yourself to SQL Server 2019, that might be a better option.
Simon
On Thu, Oct 15, 2020 at 10:08 AM Nicolas Lykke Iversen
wrote:
>
> Thank you, Simon.
>
> I'm curious whether this is the way to do it in the future, or whether
> SQLAlchemy should imple
):
cursor.setinputsizes([(pyodbc.SQL_WVARCHAR,0,0),])
https://docs.sqlalchemy.org/en/13/core/events.html#sqlalchemy.events.ConnectionEvents
https://docs.sqlalchemy.org/en/13/core/events.html#sqlalchemy.events.ConnectionEvents.before_cursor_execute
Hope that helps,
Simon
On Thu, Oct 15
eclarative_base:
https://docs.sqlalchemy.org/en/13/orm/extensions/automap.html#sqlalchemy.ext.automap.automap_base
...and declarative_base accepts a "cls" argument which is used as the
base class:
https://docs.sqlalchemy.org/en/13/orm/extensions/declarative/api.html#sqlalche
tic-guid-type
Hope that helps,
Simon
--
SQLAlchemy -
The Python SQL Toolkit and Object Relational Mapper
http://www.sqlalchemy.org/
To post example code, please provide an MCVE: Minimal, Complete, and Verifiable
Example. See http://stackoverflow.com/help/mcve for a full description.
---
You
I can't see that changing.
Simon
On Thu, Sep 3, 2020 at 2:00 PM Nicolas Lykke Iversen wrote:
>
> Thanks Simon,
>
> Just to be clear:
>
>> dialect-specific options end up in table.dialect_options:
>> https://docs.sqlalchemy.org/en/13/core/metadata.html#sqlalchemy.s
ables have a default charset of latin1, and the others are utf8. The
result is that the tables that are declared to hold latin1 data
actually hold utf8, and the tables that are declared to hold utf8
actually hold double-encoded utf8.
Simon
--
SQLAlchemy -
The Python SQL Toolkit and Object Relational Mappe
/dialects/mysql/base.py#L1871
whereas sqlite does this:
https://github.com/sqlalchemy/sqlalchemy/blob/master/lib/sqlalchemy/dialects/sqlite/base.py#L1120
Simon
On Thu, Sep 3, 2020 at 5:38 AM Nicolas Lykke Iversen wrote:
>
> Thank you, Simon.
>
> Yes, __table_args__ is the only reason
t;sqlite_autoincrement": True,
}
id = sa.Column(sa.Integer(), primary_key=True)
name = sa.Column(sa.Text())
engine = sa.create_engine("sqlite:///", echo=True)
Base.metadata.create_all(engine)
Simon
On Fri, Aug 28, 2020 at 10:35 AM Nicolas Lykke Iversen
wr
n session.query(User):
value = getattr(user, attrname)
print(value)
Simon
On Wed, Aug 19, 2020 at 3:20 PM Mike Bayer wrote:
>
> __table__ is public (private would be a single or double underscore prefix
> only), but also you could use inspect(cls).column_attrs:
>
> ht
data will not match what is in the database.
Hope that helps,
Simon
On Wed, Aug 12, 2020 at 3:05 AM William Phillips wrote:
>
> For the sake of completeness I am including the code to disconnect an option
> from a machine using only python/SQLite code.
>
> def removeOption(b
query.html#sqlalchemy.orm.query.Query.exists
Hope that helps,
Simon
On Fri, Aug 14, 2020 at 3:56 PM Prerna Pandit wrote:
>
> Hey Simon,
>
> Thanks so much for replying to my question. I reworked my code to use
> sqlalchemy ORM and took off flask and paginate so I can narrow down the
>
along a one-to-many relationship, because if you have
(for example) 2 "parent" objects, each with 5 "child" objects, the
query will return 10 rows, but SQLAlchemy de-duplicates the results to
return just the 2 parent objects.
Simon
On Thu, Aug 13, 2020 at 3:31 PM Prerna Pandit
Not in the traditional sense, no. ORDER BY is implemented by the
database, and with client-side encryption, the database only ever sees
encrypted strings.
Simon
On Fri, Jul 10, 2020 at 8:41 AM Justin Van Vuuren wrote:
>
> Also, regarding the client side approach, would one be able
hat the queries look correct (for example, they have the right
join conditions). If they look OK but they run slowly, use your
database's tools (eg. EXPLAIN or EXPLAIN ANALYZE) to understand why.
Simon
On Wed, Jul 8, 2020 at 8:22 AM Justvuur wrote:
>
> I'd like to redesign the DB b
t swapping,
which would hurt performance, in which case querying for smaller
amounts of data might be better.
Simon
On Tue, Jul 7, 2020 at 12:53 PM Justvuur wrote:
>
> I'm currently testing with 7000 students with 181 subjects.
> I first went over to the DB to run the query direc
How long is it taking? You mentioned 2000 students with 100 subjects
each, so there are something like 200,000 rows in the Subjects table,
and you need to load all of it. I wouldn't expect that to take longer
than a couple of seconds though.
Simon
On Mon, Jul 6, 2020 at 7:34 PM Justvuur wrote
for every student in a single query:
https://docs.sqlalchemy.org/en/13/orm/loading_relationships.html#joined-eager-loading
Simon
On Fri, Jul 3, 2020 at 1:36 PM Justvuur wrote:
>
> Hi Simon, thanks for the help! I've never used that before, it's quite handy.
>
> I'm looping through all the
-examples.dynamic_dict
https://docs.sqlalchemy.org/en/13/orm/examples.html#module-examples.vertical
Hope that helps,
Simon
On Thu, Jul 2, 2020 at 8:46 PM Justvuur wrote:
>
> Hi there,
>
> I'm struggling to find an efficient way to get a two columned subset into
> dictionary f
ameterized and the parameters are sent
separately, so attackers can't change the syntactic form of the
statement.
Simon
On Wed, Jul 1, 2020 at 4:21 PM divyashi...@gmail.com
wrote:
>
> SQL injections in the sense , malacious sql statements. or paylaod .
>
> On Wednesday, July 1, 2020 at 10:0
Hi,
What do you mean by "SQL injection"?
Thanks,
Simon
On Tue, Jun 30, 2020 at 10:12 PM Divya Shivakumar
wrote:
>
> Hey how do i generate new sql injections from sqlalchemy . Any links or
> information is much appreciated
>
> --
> SQLAlchemy -
> The Python SQ
://docs.sqlalchemy.org/en/13/orm/basic_relationships.html#deleting-rows-from-the-many-to-many-table
(note that accessing "contract.permissions" will load all the permissions
for that contract from the database, which might be inefficient depending
on your application)
Hope that helps,
Simon
On F
What are the values of "encoding" and "nencoding" on the connection object?
https://github.com/oracle/python-cx_Oracle/issues/36
https://stackoverflow.com/a/37600367/395053
You probably need to grab the raw dbapi connection:
It might help to display the stack trace when the encoding fails, so
we can see exactly where the error is coming from.
Simon
On Wed, May 6, 2020 at 9:01 AM Anno Nühm wrote:
>
> I am currently engaged in evaluating SQLAlchemy for a new project. When
> trying to execute queries conta
Do you need it to be an actual relationship? It's common to use an
association proxy for this:
https://docs.sqlalchemy.org/en/13/orm/extensions/associationproxy.html#simplifying-association-objects
Hope that helps,
Simon
On Fri, Mar 20, 2020 at 7:47 PM Mark Aquino wrote:
>
> I'
It's difficult to answer this question without knowing how your code
is structured. Are you reflecting your tables from the database, or
have you defined them statically?
What is the full stack trace when you get those errors?
Simon
On Wed, Mar 25, 2020 at 10:27 AM Javier Collado Jiménez
wrote
ts
or you could use the "creator" argument to specify your own function
for creating the connection:
https://docs.sqlalchemy.org/en/13/core/engines.html#sqlalchemy.create_engine.params.creator
Hope that helps,
Simon
On Wed, Mar 25, 2020 at 12:15 AM Lakshman Pervatoj wrote:
>
>
n.ColumnElement.op
Something like this:
select([testa.c.id.op("&")(15)])
Hope that helps,
Simon
On Tue, Feb 25, 2020 at 5:02 PM Balukrishnan wrote:
>
> Table definition
>
> from sqlalchemy import *
> testa = Table(
> "testa",
> metadata,
agining what it would mean to
have an instance of B (which due to inheritance is also an instance of
A) which has different values in A.visible_id and B.visible_id.
Simon
--
SQLAlchemy -
The Python SQL Toolkit and Object Relational Mapper
http://www.sqlalchemy.org/
To post example code, please prov
1 - 100 of 921 matches
Mail list logo