On Thu, Sep 13, 2018 at 10:45 AM wrote:
>
> Hello,
>
> I’d like to get some clarification on the following two code examples. First,
> bulk delete an object:
>
> >>> u = dbsession.query(User).first()
> >>> u.id
> '0078ccdf7db046179c59bff01199c25e'
> >>> dbsession.query(User).filter(User.id ==
>
On Tue, Sep 11, 2018 at 9:39 AM George Brande wrote:
>
> Hello.
>
> My angular is using a datepicker to send a date in string format(ex:
> 2018-09-11) to my flask app to postgres via sqlalchemy.
> In my postgres all rows have a column ef_time of timestamps type.(ex:
> 2018-09-07 13:24:30.138)
>
On Tue, Sep 4, 2018 at 3:48 PM wrote:
>
> I'd like to create a mixin to specify naming conventions.
>
> I tried both:
>
> class Base:
> metadata = MetaData(naming_convention={
> "ix": "ix_%(column_0_label)s",
> "uq": "uq_%(table_name)s_%(column_0_name)s",
> "ck": "ck_%(
Here's a version which I *think* does what you want. There are a
couple of things that you might want to note.
First, in your paste, Conversation.user1 and Conversation.user2 are
integer columns, but you are assigning User objects to those
properties. That's not the way SQLAlchemy works - you can'
On Tue, Aug 28, 2018 at 5:53 PM Simon King wrote:
>
> On Tue, Aug 28, 2018 at 4:32 PM 'Brian DeRocher' via sqlalchemy
> wrote:
> >
> > Hey all,
> >
> > I'm writing some automated tests for some legacy python code using a
> > psycopg2 connec
On Tue, Aug 28, 2018 at 4:32 PM 'Brian DeRocher' via sqlalchemy
wrote:
>
> Hey all,
>
> I'm writing some automated tests for some legacy python code using a psycopg2
> connection. I'd like to check data in the database by using SQLAlchemy. I
> rollback the database transaction after each test
quot; is coming from.
>
>
> On Wednesday, August 22, 2018 at 10:37:30 AM UTC+2, Simon King wrote:
>>
>> I've never used Pandas, so this may not make any sense, but where does
>> the column "VARIABLE_VALUE" come from? Is it a column in your
>> datafr
I've never used Pandas, so this may not make any sense, but where does
the column "VARIABLE_VALUE" come from? Is it a column in your
dataframe?
Simon
On Wed, Aug 22, 2018 at 8:52 AM wrote:
>
> I get the following warnings, when trying to save a simple dataframe to
> mysql.:
>
> > C:\...\anacond
If you are using SQLAlchemy core, there's this:
http://docs.sqlalchemy.org/en/latest/dialects/postgresql.html#insert-on-conflict-upsert
Does that meet your needs?
Simon
On Tue, Aug 21, 2018 at 3:36 AM Hardik Sanghavi wrote:
>
> Did this get resolved or are we to still ignore it
>
>
> On Wednes
You could build this, but it's going to be messy. At the SQL level, if
you look at an Address row, there's not enough information to know
which association table to look in. You'd have to query all of the
association tables (perhaps using a UNION) to find the one that
contains the parent, and then
y auto generated is not use, how specify it.
>
> auto generated sql : ALTER TABLE invite_code ALTER COLUMN created_at TYPE
> TIMESTAMP WITH TIME ZONE
>
> 在 2018年7月26日星期四 UTC+8下午6:16:10,Simon King写道:
>>
>> On Thu, Jul 26, 2018 at 11:03 AM Yingchen Zhang wr
On Thu, Jul 26, 2018 at 11:03 AM Yingchen Zhang wrote:
>
> old model
>
> class User(db.Model):
> __tablename__ = 'users'
> id = db.Column(db.BigInteger, primary_key=True)
> name = db.Column(db.VARCHAR(50), nullable=False)
>
> email = db.Column(db.VARCHAR(200), nullable=False)
>
>
On Mon, Jul 2, 2018 at 4:39 AM Juan wrote:
>
> Hi,
>
> I do not know if this is that I am missing something in how SQLAlchemy
> works or an issue; I have read the doc and searched for an explanation
> but could not find an answer.
>
> When appending via an intermediate table, a M2M relationship
What does the SQL look like for each of your queries?
Can you produce a standalone script that demonstrates the problem? You
could use my script from
https://groups.google.com/forum/#!topic/sqlalchemy/GNIBQMvMRg8 as a
template.
Thanks,
Simon
On Fri, Jun 1, 2018 at 2:41 PM wrote:
>
> I'm trying
(Note that sqlalchemy-diff is not part of sqlalchemy, it's a tool
built on top of it, and there may not be anyone on this list who has
ever used it)
Something like this might do what you want:
from pprint import pprint
from sqlalchemydiff import compare
D
On Tue, May 22, 2018 at 12:03 PM, Neethu Abhinav
wrote:
> Hi,
>
> I have installed sqlalchemy 1.2.7, and went through the docs for sqlAlchemy
> Diff, but i am still confused on how to use it effectively for my
> requirement.
>
> We use Oracle 12C
>
> 1. We have two databases, which have the schema
> I tried --hidden-import sqlalchemy_teradata. It didnt help. Any way thanks
> for the suggestion.
>
> On Wednesday, May 16, 2018 at 3:26:48 AM UTC-5, Simon King wrote:
>>
>> On Tue, May 15, 2018 at 8:59 PM, wrote:
>> > I have been struggling for a few days due
On Fri, May 18, 2018 at 12:19 PM, Benjamin B. wrote:
> Hello everybody,
>
> TL;DR We are experiencing a bug where, with perfectly valid data, the
> polymorphic_identity is randomly (0,05%) not respected, and the object
> ends-up being the parent class instead of the "requested" child class.
>
> Fi
On Tue, May 15, 2018 at 8:59 PM, wrote:
> I have been struggling for a few days due to an issue with SQLAlchemy.
>
> The line of code which is giving problem is
>
> engine =
> sqlalchemy.create_engine('teradata://pwd@DBinstance?driver=Teradata')
>
> This code works perfectly fine while running fr
On Mon, May 14, 2018 at 9:37 AM, wrote:
> Hi, I'm still relatively a newby to SQLAlchemy and not sure if I'm using the
> correct query to achieve what I'm trying to and hoping someone can point me
> in the correct direction or help me understand what I need to use to run the
> query I'm attemptin
On Tue, May 1, 2018 at 2:35 PM, wrote:
> I'm using the PrettyPrinted tutorial on Many to Many relationships with
> Flask-SQLAlchemy however what I'm trying to figure out he doesn't go into in
> the tutorial and I haven't had much luck in _Essential SQLAlchemy_ or
> StackOverflow finding a solutio
No, you'll need to convert that to the equivalent SQL.
On Fri, Apr 27, 2018 at 3:14 PM, Jeremy Flowers
wrote:
> But can you still do things like slice(0,5)? Struggling to get that to work
> atm...
>
> On Fri, Apr 27, 2018 at 2:48 PM, Simon King wrote:
>>
>> On
On Fri, Apr 27, 2018 at 12:57 PM, Jeremy Flowers
wrote:
> Right...
> Been trawling back thru this chain of exchanges..
> Looking for this:
>>
>> At this point I would echo Mike's question: why can't you just use
>> "text()"?
>
> Just spotted another comment from Mike, that I've just fixed too...
>
The ".first()" method applies the DB-specific equivalent of "LIMIT 1"
to the query. Oracle apparently doesn't support the LIMIT keyword, so
SQLAlchemy wraps the entire query in "SELECT ... FROM (subquery) WHERE
ROWNUM <= limit":
http://docs.sqlalchemy.org/en/latest/dialects/oracle.html#limit-offse
On Tue, Apr 24, 2018 at 4:49 AM, sum abiut wrote:
> I have two date picker fields that i want the users to select from date to
> end date. and i want to display data between the two dates that was
> selected. From example form date: 2/14/2018 to date:3/15/2018. when the
> function is called i want
On Tue, Apr 24, 2018 at 4:43 PM, Steve Murphy wrote:
> I'm just not getting it:
>
> Want: select max(id) from table;
>
> attempt (latest):
>
> from sqlalchemy import *
> from sqlalchemy.engine import reflection
> from sqlalchemy import schema
> from sqlalchemy import exc
> from psycopg2 import *
Trying to diagnose a problem with a query when we don't have any way
to run it for ourselves or sample data to run it against, is very
difficult. If you want more help, I think you're going to need to
produce a self-contained script with your table definitions and some
sample data, that runs agains
urned no
> FROM clauses due to auto-correlation; specify correlate() to control
> correlation manually.
>
> I am not sure how I should go about it.
>
> Thanks for your help,
>
> Greetings,
> Sugandha
>
> On Wednesday, 18 April 2018 17:27:36 UTC+2, Simon King wrote:
&g
Are you executing q2 on it's own, or nested in a larger query? If so,
can you show the code for the larger query.
I ask because you are calling ".correlate(Partsupp, Supplier, Nation,
Region)", which I think has the effect of removing those tables from
the FROM clause, in the assumption that they
On Wed, Apr 11, 2018 at 7:40 AM, Tolstov Sergey wrote:
> I use dynamic constructor for class.
> It works fine for instance who have not foreign keys. But when FK on another
> instance it cannot load them
>
> Example:
> class left (Base):
> id = sqlalchemy.Column(UUID, primary_key = True)
> def
On Wed, Apr 4, 2018 at 4:08 AM, Jonathan Vanasco wrote:
>
>
> On Tuesday, April 3, 2018 at 10:34:03 PM UTC-4, Mike Bayer wrote:
>>
>> "does not work" ?
>
>
> wow, i am an awful person. sorry. that is the least helpful description of
> what happens i can think of.
>
> second try:
>
> if the subque
On Thu, Mar 29, 2018 at 8:57 AM, wrote:
> Hello,
>
> I had some database problems (unfinished transactions) so I have wrapped
> sqlalchemy database handling functions in following way:
>
> def add(entry, session):
> """Wrapper for db_session.add"""
> try:
> return session.add(entr
On Sat, Mar 17, 2018 at 7:02 PM, Derek Lambert
wrote:
> I'm probably overlooking something simple, looking for feedback before
> opening an issue.
>
> I have some objects with relationships defined between. When I create a new
> related object and pass it in the append() method of the collection
>
On Wed, Feb 21, 2018 at 6:14 AM, wrote:
> Hello,
> Suppose I create a db session the normal way:
>
engine = engine_from_config({"sqlalchemy.url":"mysql+pymysql://…"})
Session = sessionmaker(bind=engine)
session = Session()
>
> I noticed that there is now an order dependency between
OK, so what's not working?
On Fri, Feb 16, 2018 at 10:55 AM, wrote:
> Yes session.is_active is True.
> I really sure, because i log this operation.
>
> пятница, 16 февраля 2018 г., 13:50:51 UTC+3 пользователь Simon King написал:
>>
>> You haven't explained in w
>> You need just that:
>> from proj.core import Session
>>
>> @app.teardown_request
>> def clear_session():
>> Session.remove()
>>
>> Session created with scoper_session, of course. We do not use
>> flask-sqlalchemy package, just flask and s
7;all':
> return result.fetchall()
> elif fetch is False:
> return list()
> elif fetch == 'count':
> return result
> return result.fetchone()
>
> But same error. That variant must always close connectio
scope_func():
>> > return scoped_session(sessionmaker(bind=engine, autocommit=True))()
>> >
>> >
>> > @decorator_with_args
>> > def session_decorator(func, default=None, **kwargs):
>> > def wrapper(*a, **kw):
>> >
On Thu, Feb 15, 2018 at 5:09 AM, George wrote:
> I have searched the documentation but didn't find anything useful. Please
> guide me in the right direction.
>
I'm not sure I understand the question. Relationships are part of the
ORM layer of SQLAlchemy, not Core. Can you explain what you're look
>
> print('#FUNCTION NAME: {}'.format(func.__name__))
>
> print(e)
> logging.error(e)
> return default
> return wrapper
>
>
>
>
> среда, 14 февраля 2018 г., 17:06:54 UTC+3 пользователь Simon King на
The pattern you should be aiming for is one in which a fresh
transaction is started for every web request that touches the
database, and that the transaction is closed at the end of the
request. How are you ensuring that at the moment?
Simon
On Wed, Feb 14, 2018 at 12:51 PM, wrote:
> If I run t
alled.
>
>
> On Friday, 9 February 2018 12:36:26 UTC+1, Simon King wrote:
>>
>> On Wed, Feb 7, 2018 at 2:23 PM, su-sa wrote:
>> > Hallo everyone,
>> >
>> > I am trying to run all the pytest of sqlalchemy. But I always get the
>> > error
>>
On Fri, Feb 9, 2018 at 7:38 PM, Jeremy Flowers
wrote:
> And I do want to use this functionality repeatedly on many columns, hence
> the idea of registering a function.
>
For what it's worth, I would do it something like this:
def removechars(col, chars):
for c in chars:
col = sa.func
As you say, .join() produces an inner join by default. You can specify
isouter=True to get a left outer join (or call the .outerjoin method
instead), and full=True to get a full outer join. I think you'd get a
cross join if you just didn't call the .join() method at all.
Simon
On Fri, Feb 9, 2018
.query(Jobmst)
>> .with_entities(Jobmst.jobmst_type, Jobmst.jobmst_name)
>> .first()
>> )
>>
>> and that worked a treat too.
>> Thanks.
>>
>>
>> On Friday, 9 February 2018 11:58:18 UTC, Simon King wrote:
>>
The chaining-friendly method you are looking for is probably with_entities():
http://docs.sqlalchemy.org/en/latest/orm/query.html#sqlalchemy.orm.query.Query.with_entities
Simon
On Fri, Feb 9, 2018 at 11:52 AM, Jeremy Flowers
wrote:
> From watching your videos I always thought some sort of query
The main point you should take from Mike's original reply is:
.values() is a weird method and it's pretty old, usually people
just set the columns up front
You probably shouldn't use it.
On Fri, Feb 9, 2018 at 11:45 AM, Jeremy Flowers
wrote:
> Also this didn't work for me:
>
> print(session
On Fri, Feb 9, 2018 at 6:06 AM, Charles Heizer wrote:
> Hello, does anyone know if it's possible to query a query result in
> SQLAlchemy?
>
> Thanks!
>
I'm not quite sure what you mean. If you've got a Query object with
some filter conditions already defined, you can add further
restrictions to i
On Wed, Feb 7, 2018 at 2:23 PM, su-sa wrote:
> Hallo everyone,
>
> I am trying to run all the pytest of sqlalchemy. But I always get the error
> - SQLAlchemy requires Mock as of version 0.8.2. I already have the mock
> library installed. Could somebody please help me to solve the problem.
>
How h
On Tue, Feb 6, 2018 at 7:08 PM, wrote:
> If I were to go into my MySQL DB and
>
> mysql> SET GLOBAL sql_mode='STRICT_TRANS_TABLES';
>
> would that have the same effect? I find the MySQL documentation somewhat
> lacking on that topic. What are the scope and lifetime of the above vs.
> using a list
On Wed, Jan 31, 2018 at 5:27 PM, Stanislav Lobanov wrote:
> Hello, i need to create a system, that can store historical versions of
> objects.
>
> Example model looks like:
>
> class User(Base):
>id=Column(Integer) # ForeignKey
>start=Column(DateTime)
>end=Column(DateTime)
>name=C
,
> ground_station=ground_station,
>aos=aos, los=los, tca=tca,
>deltaT=deltaT)
>
>
> `self` should be a reference to the instance of `Satellite` already loaded
> from DB. I will try to dive more into the code
for your kind answer.
> So when I have several threads trying to insert/update the same database
> (pgsql or sqlite) at the same time, how can I ensure consistency? By using
> scoped session? This will rely on the DB implementation behind, right?
>
> 在 2018年1月15日星期一 UTC+8下午5:21:42,Simon
On Mon, Jan 15, 2018 at 8:34 AM, wrote:
> Hello,
>
> Sessions are not thread safe.
> But for the scoped sessions, each thread will have its own session, my
> question is, even the scoped session itself rely on the thread safety
> feature of the DB behind?
> for example, PGSQL server may handle m
On Sat, Jan 13, 2018 at 3:31 PM, Ruben Di Battista
wrote:
>
>
> On Friday, January 12, 2018 at 10:54:49 AM UTC+1, Simon King wrote:
>>
>> If I understand your code correctly, scheduler.propagate() creates a
>> large number of Passage instances, and you only want a sm
If I understand your code correctly, scheduler.propagate() creates a
large number of Passage instances, and you only want a small subset of
them to be added to the database. Is that correct?
I would guess that the passages are getting added to the session
because you are setting their 'satellite'
On Thu, Jan 11, 2018 at 4:51 PM, Mischa S wrote:
> In [6]: ClassificationTask.query.update(values={'completed': True})
> INFO [sqlalchemy.engine.base.Engine] base.py:679 BEGIN (implicit)
> INFO [sqlalchemy.engine.base.Engine] base.py:1140 UPDATE schwartz_task
> SET completed=%(completed)s
On Tue, Jan 2, 2018 at 11:59 PM, Nikola Jankovic wrote:
> I have an API endpoint that handles searches from the frontend. A search can
> have a dynamic amount of filters applied to it, including (1) sizes, (2)
> colors, (3) price, and (4) category that are passed through query
> parameters. Sizes
On Wed, Dec 13, 2017 at 10:24 PM, Leo Simmons wrote:
> I have a table `special_product_list` and a table
> `special_product_historical_details_list` that holds information of products
> over time, where there's a record in the history table every day for every
> product.
>
> I want to write a quer
On Sun, Nov 26, 2017 at 11:19 AM, Mischa S wrote:
> I want to have a polymorphic table that gets its identity from a column in a
> "type" table. I have a "task" table and a "task_type" table. I want to be
> able to create task subclasses that say something like:
>
> __mapper_args__ = {
>
On Thu, Nov 23, 2017 at 6:55 PM, Антонио Антуан wrote:
>
>
> чт, 23 нояб. 2017 г. в 20:27, Mike Bayer :
>>
>> On Thu, Nov 23, 2017 at 8:44 AM, Антонио Антуан
>> wrote:
>> >
>> >> A Query can have lots of entities in it, and if you're doing sharding a
>> >> single result set can refer to any numbe
On Thu, Nov 23, 2017 at 5:27 PM, Mike Bayer wrote:
> On Thu, Nov 23, 2017 at 8:44 AM, Антонио Антуан wrote:
>>
>>> A Query can have lots of entities in it, and if you're doing sharding a
>>> single result set can refer to any number of shard identifiers within
>>> not just a single result set but
I'm pretty sure that bulk_insert_mappings ends up just calling the
same code that I suggested.
What database are you using? If it's Postgres, you might be interested
in
http://docs.sqlalchemy.org/en/latest/dialects/postgresql.html#psycopg2-batch-mode
(linked from
http://docs.sqlalchemy.org/en/la
(TLDR: I think bulk_insert_mappings is the wrong function for you to use)
SQLAlchemy consists of 2 main layers. The Core layer deals with SQL
construction, database dialects, connection pooling and so on. The ORM
is built on top of Core, and is intended for people who want to work
with "mapped cla
objects were modified, give the user the choice to either commit() or
> rollback().
>
> To do that, I checked with session.dirty/deleted/new and that's when the
> initial questions arose.
>
> If there are better ways of checking, curious to learn :-)
> Thank you!
>
>
&
ou suggest to use a before_flush() to examine
> session.dirty whenever a session.query() executes?
>
> Also, is there a way to get the list of objects that have been flushed, or
> should I track them myself whenever a before_flush() event occurs?
>
> Jens
>
>
> On Thursday,
On Thu, Nov 16, 2017 at 7:45 AM, wrote:
> Hello,
>
> I've been exploring some of the session functionality that handles object
> states, and I'm quite confused. Here is what I see:
>
engine = engine_from_config({'sqlalchemy.url': 'mysql+pymysql://…'})
session_factory = sessionmaker(bind
On Wed, Nov 15, 2017 at 12:10 AM, Mike Bayer wrote:
> On Tue, Nov 14, 2017 at 2:58 PM, Olaf wrote:
>> Hello everybody.
>>
>> Is it possible to have the following relationships between three classes
>> (Animal, Car, Description) ?
>>
>> * An animal has an attribute description
>> * A car has an at
On Mon, Nov 13, 2017 at 4:35 PM, Ahmad Javed wrote:
> Thank you Simon. Appreciate your response. Just using session.remove() at
> the end of each request is not closing the connection and leave open
> connections in MySQL database. One more thing I want to tell that we have
> deployed Django appli
On Mon, Nov 13, 2017 at 3:58 AM, Ahmad Javed wrote:
> Hi,
>
> We have implemented web applications using Django and SQLAlchemy framework.
> We have distributed system in the company and some API used frequently.
>
> We are facing a problem where MySQL connections reached a maximum limit.
>
> In Dj
On Fri, Oct 27, 2017 at 4:57 PM, wrote:
> My SQLAlchemy version is 1.1.14.
>
> I'm having difficulty understanding behaviours around a polymorphic
> hierarchy.
>
> I have an AbstractConcreteBase and two subclasses.
>
> The ACB declares some attributes shared by the two subclasses, and the
> subcl
wrote:
> Looks like I have to check if _mapper_zero() returns real mapper. Otherwise
> I should pass None to "_connection_from_session()" as value of "mapper"
> argument. Right?
>
> ср, 25 окт. 2017 г. в 15:00, Антонио Антуан :
>>
>> As I mentioned befor
it is not happened when "bind" passed directly to
>> "sessionmaker"
>>
>> сб, 21 окт. 2017 г. в 18:33, Антонио Антуан :
>>>
>>>
>>>
>>> пятница, 20 октября 2017 г., 20:50:52 UTC+3 пользователь Mike Bayer
>>> написал
;>>> sqlalchemy.__version__
> '1.0.19'
>
> пятница, 20 октября 2017 г., 16:42:23 UTC+3 пользователь Simon King написал:
>>
>> On Fri, Oct 20, 2017 at 2:15 PM, Антонио Антуан wrote:
>> > Hi.
>> > I use my own `RoutingSession` and `RoutingQu
On Fri, Oct 20, 2017 at 2:15 PM, Антонио Антуан wrote:
> Hi.
> I use my own `RoutingSession` and `RoutingQuery` implementation, most of it
> inspired by `sqlalchemy.ext.horizontal_shard`:
>
> class RoutingSession(Session):
> def get_bind(self, mapper=None, clause=None, shard_id=None, **kwargs)
On Thu, Oct 19, 2017 at 9:10 PM, TazMainiac wrote:
>
>
> On Thu, Oct 19, 2017 at 2:25 PM, Jonathan Vanasco
> wrote:
>>
>> On Thursday, October 19, 2017 at 11:55:49 AM UTC-4, Taz Mainiac wrote:
>>>
>>> So - a morning spent googling does not turn up any information about
>>> Python classes having a
On Fri, Oct 6, 2017 at 9:59 AM, Martin Cigorraga
wrote:
> Hi,
>
> I'm trying to create a simple function to check the reachability of a
> Postgres database using the http method GET; if the connection can't be
> established, it should respond with a custom http error number.
>
> This is what I got
On Fri, Sep 22, 2017 at 9:42 AM, Simon King wrote:
> On Fri, Sep 22, 2017 at 8:18 AM, John Smith wrote:
>> I have the following database schema:
>>
>> Table "Parent":
>> 1. id - primary key identifier.
>> 2. type - polymorphic_identity.
>>
On Fri, Sep 22, 2017 at 8:18 AM, John Smith wrote:
> I have the following database schema:
>
> Table "Parent":
> 1. id - primary key identifier.
> 2. type - polymorphic_identity.
> 3. name - string data column.
>
> Table "Child" - inherits Parent:
> 1. id - primary key identifier.
> 2. parent_id
I've never used celery, but I believe it can fork:
http://docs.celeryproject.org/en/latest/userguide/workers.html#concurrency
Is it possible that connections are being shared between workers, and
if so could that potentially cause this problem?
Simon
On Thu, Sep 21, 2017 at 3:11 PM, Mike Bayer
Could you pair a before_commit handler with an after_flush_postexec
handler? The before_commit one would set a flag to say that you are
committing, and the after_flush_postexec one would look for that flag
before proceeding.
Simon
On Fri, Sep 15, 2017 at 12:08 AM, wrote:
> I'm writing a handler
On Thu, Sep 14, 2017 at 12:07 PM, Ankur Kumar
wrote:
>> I'm reallly sorry.
>
>
> Please also update line number 13 in api.py and api1_py as
>
> old :
> output = session.query(model.Bug_Test.value).with_for_update('read').all()
>
> New:
> output = session.query(model.Bug_Test.value).all()
>
In mod
On Thu, Sep 14, 2017 at 10:59 AM, Ankur Kumar
wrote:
>> Hello Simon,
>
>
> Thanks,
> I donot want to read uncommitted data.
>
> I want to read committed data by one API server from another API server.
>>
>>
>
> From another API server it keeps showing old data
>
Ah, sorry, I misunderstood your or
On Thu, Sep 14, 2017 at 10:03 AM, Ankur Kumar
wrote:
> I'm using Flask, sqlalchemy with MySQL database for my API server.
>
> It's working fine with one front end API server.
> But now i want to increase a front end API server in my Load balancer.
>
> So, the scenario will be two (Flask + sqlalche
I'm pretty sure the bad performance is due to pyodbc (or maybe SQL
Server) not handling *huge* numbers of bind parameters gracefully. You
are generating a query with (batch_size * n_primary_key_columns) bind
parameters, which even in your original version meant 2000 bind
parameters.
Try with a bat
; syntax?
>
> On Wednesday, August 30, 2017 at 12:07:52 PM UTC-4, Simon King wrote:
>>
>> You could also try using executemany:
>>
>>
>> http://docs.sqlalchemy.org/en/latest/core/tutorial.html#executing-multiple-statements
>>
>> I think it would look
r(800) which
> contains description text.
>
> Total record count of the table before any deletion is about 1.05 million.
>
> Python version is 3.4.5, running on a modest CentOS desktop and to be fair
> the SQL Server instance is sub optimal for development.
>
> On Wednesday,
0.0300.0000.1650.000 elements.py:2986(self_group)
> 55620.0300.0000.1870.000 result.py:1156(fetchone)
> 111310.0300.0000.0770.000 compiler.py:494()
> 111230.0290.0000.0470.000
> type_api.py:452(_cached_bind_processor)
&
On Tue, Aug 29, 2017 at 9:49 PM, Ken MacKenzie wrote:
> I have a query I have constructed and I had to deal with a composite primary
> key to select items;
>
> q = s.query(cls)
> or_cond = []
> for x in id_batch:
>
> pkf = [text(f + "=='" + v + "
On Tue, Aug 22, 2017 at 9:26 AM, Konstantin Kashin wrote:
> # Setup
> Suppose I have a table with two fields: a string primary key and a boolean
> flag. I want to query multiple rows and then update the flag across all of
> them, then commit my changes. I have a MySQL DB with the following DBAPI
>
items():
> setattr(obj, key, value)
>
>
> On Friday, 18 August 2017 19:47:50 UTC+5:30, Simon King wrote:
>>
>> No, but you can trivially write your own function to do it:
>>
>> def updateobj(obj, data):
>> for key, value in data.items():
&
be
> updated with that get instance. Is there any specific way of updating
> something like product_live_time_instance.update(data_dict).
>
>
> On Friday, 18 August 2017 19:21:12 UTC+5:30, Simon King wrote:
>>
>> On Fri, Aug 18, 2017 at 2:41 PM, pravin battula
>> wrot
On Fri, Aug 18, 2017 at 2:41 PM, pravin battula
wrote:
> Hi,
>
> I'm getting an instance of a model using a primary key like below.
> product_live_time = session.query(ProductLiveTime).get(product_id)
>
> Now, i want to update few columns using the same instance product_live_time,
> how can i do i
On Thu, Aug 17, 2017 at 12:35 AM, Neena Parikh wrote:
> Hi there!
>
> I'm looking to create a helper or decorator function that will enable us to
> "mark" a column or table as “unused”, and raise an error if that column or
> table is queried for in SQL.
>
>
> Context
> The motivation behind this i
On Fri, Jul 28, 2017 at 12:44 AM, Saurabh Bhandiwad
wrote:
> Hello experts,
>
> Apologies if this question has been asked before, I couldn't find the right
> question on internet which reflects my problem.
>
> In my project i receive SQLITE file and I need to query information. Though
> the Datab
On Tue, Jul 25, 2017 at 2:35 AM, Jinghui Niu wrote:
> I was wondering if there is a way to configure Session.commit() so on each
> successful commit, it will return the committed/updated/deleted instance's
> class.__name__ + row.id. Is this possible? Thanks.
No, there's no way to make the commit(
The key part of the stack trace is:
File "c:\Program
Files\Anaconda2\lib\site-packages\sqlalchemy\dialects\mssql\base.py",
line 1773, in _get_default_schema_name default_schema_name =
connection.scalar(query)
...which is in this function:
https://bitbucket.org/zzzeek/sqlalchemy/src/8d740d6bd6b8b
On Fri, Jun 30, 2017 at 12:44 PM, mvidalgarcia wrote:
> Hi, I'm performing a query to some data models but the ORM response time
> looks much higher compared to the SQL one. I have a script to reproduce the
> problem here.
> Currently getting values like
>
>> sql time: 0.068972826004
>> orm time:
On Wed, Jun 28, 2017 at 6:39 AM, Vigneshrajan wrote:
> Is it is possible to execute stored procedure in connection.execute()
> function?
>
I think it depends on the stored procedure. Do any of these search results help?
http://docs.sqlalchemy.org/en/latest/search.html?q=%22stored+procedure%22&ch
On Wed, Jun 28, 2017 at 1:35 AM, Andrew M wrote:
> I can also replicate it with JSON, with a table defined as follows:
>
> class Test(Base):
> __tablename__ = 'test'
> id = Column(INT, primary_key=True, index=True)
> json = Column(JSON, default={})
>
> And running the following code:
>
201 - 300 of 690 matches
Mail list logo