[sqlalchemy] Re: SQLAlchemy with MySQL on AWS Lambda is taking long time to truncate table

2023-01-04 Thread Michael Bayer
is truncate happening in some other process? does it speed up once you kill the initial python process? does this truncate take time with other kinds of INSERT statements? is the table very large? overall you need to perform more observations here as to what conditions cause this "trunc

[sqlalchemy] Re: SQLAlchemy with MySQL on AWS Lambda is taking long time to truncate table

2022-12-13 Thread Chandra Prakash
I tried this, kept commit and close statements and removed dispose statement, but yet the problem is not solved, it's taking time to truncate the table. On Wednesday, 14 December 2022 at 05:19:27 UTC+5:30 yaakovb...@gmail.com wrote: > Is it possible your sessions hasn't committed the change /

[sqlalchemy] Re: SQLAlchemy with MySQL on AWS Lambda is taking long time to truncate table

2022-12-13 Thread Yaakov Bressler
Is it possible your sessions hasn't committed the change / closed the transaction? Also, I don't think dispose is helping you here. Consider removing it? How about modifying: def add_user(): session = Session() session.add(User(**{'user_id': 1, 'name': 'user name'})) session.commit(

[sqlalchemy] Re: SQLAlchemy exists() used with first() ?

2022-08-09 Thread 'Jonathan Vanasco' via sqlalchemy
I think you misunderstand `exists()` in SQLAlchemy and SQL. `exists()` is a convenience function to create a SQL `EXISTS` clause, which is an operator used for filtering subqueries. The 'from_exists' is just a subquery. It is supposed to be used within a query which would then limit the query

[sqlalchemy] Re: SQLALCHEMY conncection to Sybase Adaptive Server Anywhere Version 7 via TCI/IP

2022-04-22 Thread Trainer Go
Thank you Gord Thompson, its working. Now i have to check how i can make a select with better performance. cause the select im using in my python programm needs i think 80 seconds and in the database its self only 13 seconds but it tested it with pd.read_sql() . Maybe the performance with sqla

[sqlalchemy] Re: SQLALCHEMY conncection to Sybase Adaptive Server Anywhere Version 7 via TCI/IP

2022-04-21 Thread Gord Thompson
create_engine() does not directly accept a raw ODBC connection string. You need to use the URL.create(…, query={"odbc_connect": …) approach that you were using in your earlier examples, except that now you will be supplying a valid connection string for the ODBC driver that you are using. On Th

[sqlalchemy] Re: SQLALCHEMY conncection to Sybase Adaptive Server Anywhere Version 7 via TCI/IP

2022-04-21 Thread Trainer Go
Hello Gord Thompson, Yeah i found this dialect documentation and its working with the pyodbc connection. and my query works with pd.read_sql() but i want to test it with sqlalchemy cause im getting an warning that i should use sqlalchemy. But thats what i wanted to do. cnxn = pyodbc.connect('

[sqlalchemy] Re: SQLALCHEMY conncection to Sybase Adaptive Server Anywhere Version 7 via TCI/IP

2022-04-21 Thread Gord Thompson
Perhaps this might help: https://www.connectionstrings.com/asa-odbc/ Note also that the sqlalchemy-sybase dialect has not been tested with the "Adaptive Server Anywhere" driver. If its behaviour differs significantly from the "SAP ASE ODBC driver" then you may have issues with that. On Thursda

[sqlalchemy] Re: SQLALCHEMY conncection to Sybase Adaptive Server Anywhere Version 7 via TCI/IP

2022-04-21 Thread Gord Thompson
> Verbindung mit dem Datenbankserver unmöglich: Datenbankserver läuft nicht "Unable to connect to database server: Database server is not running" > Ungültiges Attribut für Verbindungszeichenfolge "Invalid connection string attribute" Check the documentation for your ODBC driver to verify that

[sqlalchemy] Re: SQLALCHEMY conncection to Sybase Adaptive Server Anywhere Version 7 via TCI/IP

2022-04-21 Thread Trainer Go
Now im getting this error: pyodbc.OperationalError: ('08001', '[08001] [Sybase][ODBC Driver][Adaptive Server Anywhere]Verbindung mit dem Datenbankserver unmöglich: Datenbankserver läuft nicht (-100) (SQLDriverConnect); [08001] [Sybase][ODBC Driver]Ungültiges Attribut für Verbindungszeichenfolge

[sqlalchemy] Re: SQLALCHEMY conncection to Sybase Adaptive Server Anywhere Version 7 via TCI/IP

2022-04-20 Thread Gord Thompson
Yes, that's correct. If you are running 64-bit Python then you need to have a 64-bit version of the ODBC driver installed. 64-bit applications cannot use 32-bit drivers. On Wednesday, April 20, 2022 at 2:21:32 AM UTC-6 Trainer Go wrote: > Hi Gord Thompson, > > with print pyodbc.drivers() result

[sqlalchemy] Re: SQLALCHEMY conncection to Sybase Adaptive Server Anywhere Version 7 via TCI/IP

2022-04-20 Thread Trainer Go
Hi Gord Thompson, with print pyodbc.drivers() result = ['SQL Server', 'Microsoft Access Driver (*.mdb, *.accdb)', 'Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)', 'Microsoft Access Text Driver (*.txt, *.csv)'] but i think i know why i have problems with the connection. Cause i tried t

[sqlalchemy] Re: SQLALCHEMY conncection to Sybase Adaptive Server Anywhere Version 7 via TCI/IP

2022-04-14 Thread 'Jonathan Vanasco' via sqlalchemy
thanks, gord! On Thursday, April 14, 2022 at 12:30:44 PM UTC-4 Gord Thompson wrote: > > Der Datenquellenname wurde nicht gefunden, und es wurde kein > Standardtreiber angegeben > > "The data source name was not found and no default driver was specified" > > Use > > import pyodbc > > print(pyodbc

[sqlalchemy] Re: SQLALCHEMY conncection to Sybase Adaptive Server Anywhere Version 7 via TCI/IP

2022-04-14 Thread Gord Thompson
> Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben "The data source name was not found and no default driver was specified" Use import pyodbc print(pyodbc.drivers()) to view the names of the ODBC drivers that are available to your application. On Thursd

[sqlalchemy] Re: SQLALCHEMY conncection to Sybase Adaptive Server Anywhere Version 7 via TCI/IP

2022-04-14 Thread Trainer Go
i tried to connect my database but im getting an InterfaceError and i dont know how so solve it. connection_string = ( "DRIVER=Adaptive Server Anywhere 7.0;" "SERVER=IP;" "PORT=Port;" "UID=ID;PWD=PASSWORD;" "DATABASE=NameOfDatabase;" "charset=utf8;" ) connection_url = URL.

[sqlalchemy] Re: SQLALCHEMY conncection to Sybase Adaptive Server Anywhere Version 7 via TCI/IP

2022-04-14 Thread Trainer Go
I will try it today. Thank you very much for your help Jonathan Vanasco Jonathan Vanasco schrieb am Donnerstag, 14. April 2022 um 00:07:06 UTC+2: > The Sybase dialect was deprecated from first-party support by SQLAlchemy > and is currently unsupported. > > Gord Thompson, who is a frequent contr

[sqlalchemy] Re: SQLALCHEMY conncection to Sybase Adaptive Server Anywhere Version 7 via TCI/IP

2022-04-13 Thread 'Jonathan Vanasco' via sqlalchemy
The Sybase dialect was deprecated from first-party support by SQLAlchemy and is currently unsupported. Gord Thompson, who is a frequent contributor to the core SQLAlchemy project, and has generously taken over responsibility for the original dialect as a third-party dialect:: https://github.co

[sqlalchemy] Re: SQLAlchemy with postgres: crash sqlalchemy connection with thread parallelism,

2021-12-20 Thread Jonathan Vanasco
Please submit a "Short, Self Contained, Correct (Compilable), Example" along with any potential bug reports. http://sscce.org/ On Wednesday, December 15, 2021 at 11:29:30 AM UTC-5 Ramin Farajpour Cami wrote: > Hi, > > I'm was testing the project by fastapi + sqlalchemy, i write golang code >

Re: [sqlalchemy] Re: SqlAlchemy with Postgres: How can I make a query that checks if a string is in a list inside a json column

2021-10-19 Thread Simon King
For what it's worth, I think the "?" operator would work for this with JSONB, but not with JSON: postgres=# select '["user1", "user2"]'::jsonb ? 'user1'; ?column? -- t (1 row) postgres=# select '["user1", "user2"]'::jsonb ? 'user2'; ?column? -- t (1 row) postgres=# select '["us

[sqlalchemy] Re: SqlAlchemy with Postgres: How can I make a query that checks if a string is in a list inside a json column

2021-10-18 Thread Jonathan Vanasco
I'm not sure, but AFAIK, this type of search isn't *easily* doable in PostgreSQL. The json and jsonb operators and functions are really targeting "object literals" style data, not lists. https://www.postgresql.org/docs/current/functions-json.html In the past, I think one could search against t

[sqlalchemy] Re: SqlAlchemy with Postgres: How can I make a query that checks if a string is in a list inside a json column

2021-10-13 Thread Sergey V.
Use .any(): session.query(Gizmo).filter(Gizmo.users.any('user1')) On Wednesday, October 13, 2021 at 11:50:16 PM UTC+10 chat...@gmail.com wrote: > Imagine a Postgres JSON column with values like below: > "["user1", "user2"]" > > Is there any way to query a postgres JSON (not JSONB) column

Re: [sqlalchemy] Re: SQLAlchemy join/has query with example code

2021-02-09 Thread Chris Simpson
Thanks Mike, the assurance it's the right idea was what I wanted to check. All sorted much appreciated. On Sun, 7 Feb 2021, 21:49 Mike Bayer, wrote: > > > On Sat, Feb 6, 2021, at 8:56 AM, Chris Simpson wrote: > > After posting, I have arrived at *a* solution (which might be awful) > Please let

Re: [sqlalchemy] Re: SQLAlchemy join/has query with example code

2021-02-07 Thread Mike Bayer
On Sat, Feb 6, 2021, at 8:56 AM, Chris Simpson wrote: > After posting, I have arrived at *a* solution (which might be awful) Please > let me know if this is a bad approach or I'm following the api correctly: > > I have converted this SQL query: > > SELECT COUNT(*) > FROM person > JOIN subscrip

[sqlalchemy] Re: SQLAlchemy join/has query with example code

2021-02-06 Thread Chris Simpson
After posting, I have arrived at *a* solution (which might be awful) Please let me know if this is a bad approach or I'm following the api correctly: I have converted this SQL query: SELECT COUNT(*) FROM person JOIN subscription ON person.id = subscription.person_id JOIN plan ON subscription.sk

[sqlalchemy] Re: SQLAlchemy transaction ID

2021-01-27 Thread 'Jonathan Vanasco' via sqlalchemy
Thierry, Would you mind putting together a test-case on this? I haven't experienced that before, and I authored that feature in the debugtoolbar. If I can recreate it, I'll put together a fix and work with the pyramid team to get a new release out asap. On Wednesday, January 27, 2021 at 8:32

[sqlalchemy] Re: sqlalchemy messes up names with "_1" suffix

2020-07-10 Thread 'Jonathan Vanasco' via sqlalchemy
> i have this litte flask-admin game running, now out of nowwhere sqlalchemy has begun to add strange "_1" suffixes to the column names. i know sqlalchemy does this to keep names unique, but in my case the queries are failing SQLAlchemy does do this, for those reasons, and to the columns... but

[sqlalchemy] Re: sqlalchemy messes up names with "_1" suffix

2020-07-10 Thread Ben
Not sure if this will help but are you using FlaskWTF? If you have repeating fields on a form, some of its data structures will append a _1, _2... to each instance in your response to keep them unique. So, just a guess, but perhaps your problem is related to Flask / WTForms? On Friday, July 10,

[sqlalchemy] Re: SQLAlchemy taking too much time to process the result

2020-07-06 Thread 'Jonathan Vanasco' via sqlalchemy
On Monday, July 6, 2020 at 2:14:33 PM UTC-4, Saylee M. wrote: > So, when I passed the query to MySQL directly, it took very less time > (around 0.016 seconds) but when I passed the same > query through SQLAlchemy connector, it took around 600 seconds > "query ... MySQL directly" Do you mea

Re: [sqlalchemy] Re: SQLAlchemy: UnicodeEncodeError: 'ascii' codec can't encode characters (db engine encoding ignored?)

2020-05-06 Thread Anno Nühm
Adding the encoding parameter to the connection string did do the trick. With this now my test code is running perfectly fine, rendering the results as expected. -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provid

Re: [sqlalchemy] Re: SQLAlchemy: UnicodeEncodeError: 'ascii' codec can't encode characters (db engine encoding ignored?)

2020-05-06 Thread Mike Bayer
Alternatively, this will probably work as well, SQLAlchemy will pass it through to the client: create_engine("oracle+cx_oracle://user:pass@dsn/?encoding=utf-8") will update the docs now. >>> e = >>> create_engine("oracle+cx_oracle://scott:tiger@oracle1120/?encoding=utf-8") >>> e.dialect.create

Re: [sqlalchemy] Re: SQLAlchemy: UnicodeEncodeError: 'ascii' codec can't encode characters (db engine encoding ignored?)

2020-05-06 Thread Mike Bayer
I see you are using an "encoding" on cx_Oracle connect(), which SQLAlchemy does not use; this parameter appears to be added to cx_Oracle only recently. The standard way to set Oracle encodings is via the NLS_LANG environment variable, please use this parameter when dealing with Oracle client lib

Re: [sqlalchemy] Re: SQLAlchemy: UnicodeEncodeError: 'ascii' codec can't encode characters (db engine encoding ignored?)

2020-05-06 Thread Anno Nühm
Engine object configuration - convert_unicode = False - cx_oracle_ver = (7, 3, 0) - driver = cx_oracle - encoding = UTF8 - nencoding = -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCV

Re: [sqlalchemy] Re: SQLAlchemy: UnicodeEncodeError: 'ascii' codec can't encode characters (db engine encoding ignored?)

2020-05-06 Thread Simon King
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: https://docs.sqlalchemy.org/en/13/core/connections.html#working-with-ra

[sqlalchemy] Re: SQLAlchemy: UnicodeEncodeError: 'ascii' codec can't encode characters (db engine encoding ignored?)

2020-05-06 Thread Anno Nühm
## Traceback (most recent call last): File "/data/projects/Python/database/sqlalchemy/sqlalchemy_oracle.py", line 45, in df = pd.read_sql_query(u'SELECT owner, table_name FROM all_tables WHERE owner LIKE \'äöüßÄÖÜœ\'', co

[sqlalchemy] Re: SQLAlchemy: UnicodeEncodeError: 'ascii' codec can't encode characters (db engine encoding ignored?)

2020-05-06 Thread Anno Nühm
## Traceback (most recent call last): File "/data/projects/Python/database/sqlalchemy/sqlalchemy_oracle.py", line 45, in df = pd.read_sql_query(u'SELECT owner, table_name FROM all_tables WHERE owner LIKE \'äöüßÄÖÜœ\'', co

[sqlalchemy] Re: SQLAlchemy Memory Leak

2020-02-26 Thread Jonathan Vanasco
Memory leaks caused by SqlAlchemy are extremely rare. The code is in heavy production with tens of thousands of users. If there is a memory leak, it is likely caused by another library, or your code in how you are using SqlAlchemy. Your next step should be creating a "Short, Self Contained, Cor

[sqlalchemy] Re: SQLAlchemy - Postgres Connection Issue

2018-10-15 Thread Jonathan Vanasco
your database logs may indicate why it is closing the connection or what underlying error happened. there are dozens, if not hundreds, of potential reasons why an error like this may be happening. this could be from anything, including having too many connections, to an issue on your database

[sqlalchemy] Re: SQLAlchemy - Postgres Connection Issue

2018-10-15 Thread Shankar Ganesh
@jonathan I went through that. What is the possible reason for disconnect ? I am not restarting my dbs. On Monday, 15 October 2018 20:43:45 UTC+5:30, Jonathan Vanasco wrote: > > There are a few strategies to handling disconnects that are outlined in > the docs: > > > https://docs.sqlalchemy.

[sqlalchemy] Re: SQLAlchemy - Postgres Connection Issue

2018-10-15 Thread Jonathan Vanasco
There are a few strategies to handling disconnects that are outlined in the docs: https://docs.sqlalchemy.org/en/latest/core/pooling.html#dealing-with-disconnects -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please prov

[sqlalchemy] Re: SQLAlchemy - Postgres Connection Issue

2018-10-15 Thread Shankar Ganesh
More information Similarly, we are creating a scoped session, we are doing session.close() *I tried Null Pool which doesn't help* Any ideas on that? Relevant finding Is it odd that my SQLAlchemy MySQL connection always ends up sleeping?

[sqlalchemy] Re: [SQLAlchemy Core] JSONB in dynamic select

2018-06-15 Thread Maciek Olko
Here is what I have for now: sa.func.string_agg(sa.select([('jsonb_array_elements')['{}'].astext]).select_from(sa.select([ sa.func.jsonb_array_elements(c.acc_licence_plates)])), ' / ') But it's wrong. Regards, Maciej czw., 14 cze 2018 o 17:25 użytkownik Maciek Olko napisał: > Hello, > I'm hav

[sqlalchemy] Re: SQLAlchemy keeps dropping sessions

2018-06-05 Thread rvd
Seems I was able to mitigate the issue by adding the pool pre_ping and setting the recycle parameter to 1 minute. Seems indeed to be an RDS thing. Thanks everyone! On Sunday, June 3, 2018 at 7:17:55 PM UTC-7, rvd wrote: > > Hi all, > > I am writing a Flask API that needs to communicate with man

[sqlalchemy] Re: SQLAlchemy keeps dropping sessions

2018-06-04 Thread Jonathan Vanasco
In theory what you're claiming should be fine... but there's always a chance that what you *think* you're doing isn't really what you're doing. I suggest creating a tiny one-file flask app that mimics your behavior and reproduces the result -- then share it here. Your example on StackOverflow

Re: [sqlalchemy] Re: SQLAlchemy keeps dropping sessions

2018-06-04 Thread Mike Bayer
On Sun, Jun 3, 2018 at 11:42 PM, rvd wrote: > Hi Mike, > > Thanks for the quick reply. I am using Version 9.6.6 (RDS). I just realized Amazon offers an RDS for Postgresql. This is definitely something RDS-specific, like an idle timeout or something, though I can't find any google results for thi

Re: [sqlalchemy] Re: SQLAlchemy keeps dropping sessions

2018-06-04 Thread Mike Bayer
On Sun, Jun 3, 2018 at 11:42 PM, rvd wrote: > Hi Mike, > > Thanks for the quick reply. I am using Version 9.6.6 (RDS). Not using any > proxy. Because this was a rather blocking issue, I have been utilizing a > terrible workaround (namely creating an engine every single request, and > using that se

[sqlalchemy] Re: SQLAlchemy keeps dropping sessions

2018-06-03 Thread rvd
Hi Jonathan, I am not. This is encountered as soon as the app loads. Before request processing, I just make the engine and sessionmaker. Sessions are made from the sessionmaker per request. All of the functional code is on the SO link more or less. Is the overall pattern reasonable or have I me

[sqlalchemy] Re: SQLAlchemy keeps dropping sessions

2018-06-03 Thread rvd
Hi Mike, Thanks for the quick reply. I am using Version 9.6.6 (RDS). Not using any proxy. Because this was a rather blocking issue, I have been utilizing a terrible workaround (namely creating an engine every single request, and using that session) with some success - obviously not ideal though

[sqlalchemy] Re: SQLAlchemy keeps dropping sessions

2018-06-03 Thread rvd
On Sunday, June 3, 2018 at 7:17:55 PM UTC-7, rvd wrote: > > Hi all, > > I am writing a Flask API that needs to communicate with many datastores, > Postgres on AWS RDS being one of them. I want to avoid Flask-SQLAlchemy > (trying to reduce package dependence); I think the standard SQLAlchemy >

[sqlalchemy] Re: SQLAlchemy utility function to evaluate a string

2018-03-17 Thread Derek Lambert
I created a parser using pyparser that takes a filter string similar to what you'd pass to Query.filter(), and returns an object you can pass to Query.filter(). ex. "Child.last_name == 'Smith' AND Child.first_name LIKE 'J%' OR Child.parent_id IS NULL". This was to allow storing the query string

[sqlalchemy] Re: SQLAlchemy does not properly create temporary table for subqueries in MariaDB

2018-01-15 Thread Jonathan Vanasco
I can't speak to the internals of this being a bug or not, or how this should be done... but I think you could do a short-term (and cross platform) fix using an alias via `sqlalchemy.orm.aliased` for one (or more) of the inner subqueries. That should result in a unique discriminator being gene

Re: [sqlalchemy] Re: SQLAlchemy 1.2.0 released

2018-01-03 Thread Mike Bayer
On Wed, Jan 3, 2018 at 12:18 PM, Seth P wrote: > Perhaps this isn't the right place to ask, but do you know when > https://anaconda.org/conda-forge/sqlalchemy will be updated to 1.2.0? hm, I actually know nothing about where that comes from! sorry > > -- > SQLAlchemy - > The Python SQL Toolki

[sqlalchemy] Re: SQLAlchemy 1.2.0 released

2018-01-03 Thread Seth P
Perhaps this isn't the right place to ask, but do you know when https://anaconda.org/conda-forge/sqlalchemy will be updated to 1.2.0? -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete,

[sqlalchemy] Re: SQLAlchemy writing to SQL Server: incorrect syntax

2017-12-18 Thread Lorenzo R
no way thank you so much! promise to myself: contribute by adding code to help people with this error in the future! On Monday, December 18, 2017 at 5:35:13 PM UTC+1, Lorenzo R wrote: > > Hi, having an error when writing a dataframe to db and can't find a > solution out there. Have used sqlalche

[sqlalchemy] Re: SQLAlchemy : declarative_base and metaclass conflict

2017-10-20 Thread Sven
Exactly what I was looking for and it works (even applied to my project). I tried so many things these last days and the solution now looks so simple. Thank you very much ! -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, pl

[sqlalchemy] Re: SQLAlchemy : declarative_base and metaclass conflict

2017-10-20 Thread Sven Dumay
Version of Python : 3.4.0 Version of SQLAlchemy : 1.2.0b2 -- 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 ful

[sqlalchemy] Re: SQLAlchemy many-to-many Postgresql double delete

2017-09-30 Thread Tolstov Sergey
Mike, thanks for answer. But that's not true. I use them on project and it works. Ilja Everilä on StackOverflow help me. Answer is: I need a create functions. In [6]: def class_name_collection(base, local_cls, referred_cls, constraint)

[sqlalchemy] Re: sqlalchemy foreignkey relation with inheritance

2017-09-22 Thread John Smith
Whoa! Fantastic! Thank you very much!!! -- 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. ---

[sqlalchemy] Re: sqlalchemy foreignkey relation with inheritance

2017-09-22 Thread John Smith
Btw, I'm libraries versions are SQLAlchemy==1.1.14 psycopg2==2.7.1 -- 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

Re: [sqlalchemy] Re: Sqlalchemy unable to work with azure SQL server ( The rest aws local all works)

2017-09-18 Thread Mike Bayer
On Mon, Sep 18, 2017 at 2:44 PM, suman deb wrote: > It does connect > > root@DNDSaltMaster:~# tsql -S testservercri.database.windows.net -U criuser > Password: > locale is "en_US.UTF-8" > locale charset is "UTF-8" > using default charset "UTF-8" > 1> r > > [testservercri] > host = testserv

[sqlalchemy] Re: Sqlalchemy unable to work with azure SQL server ( The rest aws local all works)

2017-09-18 Thread suman deb
It does connect root@DNDSaltMaster:~# tsql -S testservercri.database.windows.net -U criuser Password: locale is "en_US.UTF-8" locale charset is "UTF-8" using default charset "UTF-8" 1> r [testservercri] host = testservercri.database.windows.net port = 1433 tds version = 7.

[sqlalchemy] Re: Sqlalchemy event `append` listener causes UNIQUE constraint failed

2017-09-15 Thread Conferency
SQLAlchemy (1.0.8) On Friday, September 15, 2017 at 12:14:33 PM UTC-4, Conferency wrote: > > class Paper(db.Model): > __tablename__ = 'papers' > reviewers = db.relationship('User', secondary=paper_reviewer, > backref=db.backref('papers_reviewed', >

[sqlalchemy] Re: SQLAlchemy 1.1.14 released

2017-09-05 Thread Jonathan Vanasco
Thank You, Mike. -- 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 received this mess

[sqlalchemy] Re: SQLAlchemy: backref and object loaded from DB not working?

2017-08-22 Thread cecemel
yep indeed, it works, I was doing something wrong. Thanks for all the help and sorry about late reply On Thursday, August 17, 2017 at 9:57:39 PM UTC+2, cecemel wrote: > > Is the backref relationship supposed to work with objects loaded from the > DB? > > > Here is the case: > > Similar to the

Re: [sqlalchemy] Re: SQLAlchemy 1.2.0b1 released

2017-07-12 Thread yoch . melka
OK, thank a lot ! Le jeudi 13 juillet 2017 06:01:45 UTC+3, Mike Bayer a écrit : > > this is how that would have to be mapped, hypothetically: > > class EngineerBase(Person): > __tablename__ = 'engineer' > > id = Column(ForeignKey('person.id'), primary_key=True) > engineer_name = Co

Re: [sqlalchemy] Re: SQLAlchemy 1.2.0b1 released

2017-07-12 Thread Mike Bayer
this is how that would have to be mapped, hypothetically: class EngineerBase(Person): __tablename__ = 'engineer' id = Column(ForeignKey('person.id'), primary_key=True) engineer_name = Column(String(30)) __mapper_args__ = { 'polymorphic_load': 'selectin' } class Engi

Re: [sqlalchemy] Re: SQLAlchemy 1.2.0b1 released

2017-07-12 Thread yoch . melka
Here a MCWE : from sqlalchemy import Table, Column, Integer, String, ForeignKey, create_engine from sqlalchemy.orm import Session from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() class Person(Base): __tablename__ = 'person' id = Column(Integer, primar

Re: [sqlalchemy] Re: SQLAlchemy 1.2.0b1 released

2017-07-12 Thread yoch . melka
I have a mixed configuration with both joined and single table subclasses in a two-levels inheritance (like that ), so selectin seems to be the right choice for me. Le jeudi 13 juillet 2017 01:09:50 UTC+3, Mike Bayer a écrit : > >

Re: [sqlalchemy] Re: SQLAlchemy 1.2.0b1 released

2017-07-12 Thread Mike Bayer
On Wed, Jul 12, 2017 at 4:54 PM, wrote: > I noticed that {'polymorphic_load': 'selectin'} on single table inheritance > can make several SQL queries unnecessarily. well "selectin" loading would be inappropriate for single table inheritance because you are telling it to emit additional queries fo

[sqlalchemy] Re: SQLAlchemy 1.2.0b1 released

2017-07-12 Thread yoch . melka
I noticed that {'polymorphic_load': 'selectin'} on single table inheritance can make several SQL queries unnecessarily. Le mercredi 12 juillet 2017 22:02:04 UTC+3, yoch@gmail.com a écrit : > > Very awaited version for me (because the selectin) ! > > I tested in my code both the eagerload and

[sqlalchemy] Re: SQLAlchemy 1.2.0b1 released

2017-07-12 Thread yoch . melka
Very awaited version for me (because the selectin) ! I tested in my code both the eagerload and the polymorphic usages, and everything works perfectly. Thank you Mike Le lundi 10 juillet 2017 16:44:03 UTC+3, Mike Bayer a écrit : > > SQLAlchemy release 1.2.0b1 is now available. > > This is the

[sqlalchemy] Re: SQLAlchemy and pymssql and cyrillic names of tables/columns

2017-07-12 Thread Belegnar Dragon
Everything works fine with freetds compiled at git master пятница, 18 апреля 2014 г., 16:06:30 UTC+4 пользователь Belegnar Dragon написал: > > Hello! > > Is it possible to handle with SQLAlchemy mssql database with cyrillic > table and column names? > > -- > WBR, > TO > > -- SQLAlchemy - The

Re: [sqlalchemy] Re: SQLAlchemy 1.2.0b1 released

2017-07-11 Thread Jonathan Vanasco
Great! Thank you!. Good to know the behavior hasn't changed. We have a lot of "read-only" routes or database-free routes which rely on the "lazy" transaction/connection behavior for performance. I was worried the new flag could create db connectivity per-request when the session is create

Re: [sqlalchemy] Re: SQLAlchemy 1.2.0b1 released

2017-07-11 Thread Mike Bayer
the Session doesn't pull the connection from the engine until you do a query or call session.connection(), session.execute(), etc. This is because the Session supports multiple engines simultaenously and it doesn't know which one to use until it's asked to query something. On Tue, Jul 11, 2017 at

Re: [sqlalchemy] Re: SQLAlchemy 1.2.0b1 released

2017-07-11 Thread Jonathan Vanasco
On Tuesday, July 11, 2017 at 10:27:15 AM UTC-4, Mike Bayer wrote: > > So the note for this is at: > > > http://docs.sqlalchemy.org/en/latest/changelog/migration_12.html#pessimistic-disconnection-detection-added-to-the-connection-pool > > > then in the main docs, the new flag replaces the previ

Re: [sqlalchemy] Re: SQLAlchemy 1.2.0b1 released

2017-07-11 Thread Mike Bayer
On Mon, Jul 10, 2017 at 5:58 PM, Jonathan Vanasco wrote: > > > On Monday, July 10, 2017 at 9:44:03 AM UTC-4, Mike Bayer wrote: >> >> * Connection pool pre-ping - The connection pool now includes an >> optional "pre ping" feature that will test the "liveness" of a pooled >> connection for every con

[sqlalchemy] Re: SQLAlchemy 1.2.0b1 released

2017-07-10 Thread Jonathan Vanasco
On Monday, July 10, 2017 at 9:44:03 AM UTC-4, Mike Bayer wrote: > > * Connection pool pre-ping - The connection pool now includes an > optional "pre ping" feature that will test the "liveness" of a pooled > connection for every connection checkout, transparently recycling the > DBAPI connectio

Re: [sqlalchemy] Re: SQLAlchemy JTI subqueryload bug

2017-06-19 Thread mike bayer
thanks! if they're deep "incorrect query" things in the ORM like this, I fix those really fast. Inconvenient things with Core / typing system etc., not so much :) On 06/19/2017 12:12 AM, Sherwin Yu wrote: Mike, thanks for responding and fixing this so quickly (https://bitbucket.org/zzzeek

[sqlalchemy] Re: SQLAlchemy JTI subqueryload bug

2017-06-18 Thread Sherwin Yu
Mike, thanks for responding and fixing this so quickly (https://bitbucket.org/zzzeek/sqlalchemy/issues/4011/joined-subclass-to-2-level-subquery-load#comment-37650645)! Just wanted to take a moment to express my gratitude for your work on SQLA -- it's absolutely critical to our company (Benchling

[sqlalchemy] Re: SQLalchemy change polymorphic identity

2017-05-11 Thread manotelefonis
Thank you for prompt answer and a ref to the issue case. That is helpful. Just to be clear - all the Job (PAJob, ManagerJob, EngineerJob) classes objects are using the same ONE 'job' table. In out case and the class only determine allowed values for some fields (validations basically). So i do

[sqlalchemy] Re: SqlAlchemy memory usage

2017-01-15 Thread Jonathan Vanasco
On Saturday, January 14, 2017 at 3:06:21 AM UTC-5, Nikunj Yadav wrote: > > But I am interested in knowing, assuming the dumbest setting that I could > have done is it possible that sqlalchemy is keeping a lot of references in > memory ? > > Perhaps I can think of a dumber mistake than Mike did

[sqlalchemy] Re: SQLAlchemy 1.1.4 - How do I get SQLAlchemy to raise an exception when appending a duplicate persistent object that is already mapped in a relationship?

2016-12-07 Thread 'dcs3spp' via sqlalchemy
Ok cheers Mike. So I detect at collection level and then throw Exception if already a member. So I might get better performance by changing collection to a set and checking for membership before adding via the event listener. Ok, thanks for your help and suggestions. Much appreciated :) Cheers

Re: [sqlalchemy] Re: SQLAlchemy 1.1.4 - How do I get SQLAlchemy to raise an exception when appending a duplicate persistent object that is already mapped in a relationship?

2016-12-07 Thread mike bayer
On 12/07/2016 12:00 PM, 'dcs3spp' via sqlalchemy wrote: Hi Mike, Thanks for getting back to me and suggesting viable workarounds :) Will probably go with the event listener approach. Is it worthwhile submitting this as an issue on bitbucket? I just looked a little more closely here and real

[sqlalchemy] Re: SQLAlchemy 1.1.4 - How do I get SQLAlchemy to raise an exception when appending a duplicate persistent object that is already mapped in a relationship?

2016-12-07 Thread 'dcs3spp' via sqlalchemy
Hi Mike, Thanks for getting back to me and suggesting viable workarounds :) Will probably go with the event listener approach. Is it worthwhile submitting this as an issue on bitbucket? Cheers Simon On Tuesday, 6 December 2016 14:36:15 UTC, dcs3spp wrote: > > Hi, > > > I am running SQLAlchemy

Re: [sqlalchemy] Re: SQLAlchemy 1.1.4 - How do I get SQLAlchemy to raise an exception when appending a duplicate persistent object that is already mapped in a relationship?

2016-12-07 Thread mike bayer
On 12/07/2016 06:29 AM, 'dcs3spp' via sqlalchemy wrote: Hi, Have tried code sample and it does indeed throw a duplicate :) This is under the condition for 1:m with a fresh object instance created that has a duplicate key id. I have created a smaller example for the scenario I am using. This i

Re: [sqlalchemy] Re: SQLAlchemy 1.1.4 - How do I get SQLAlchemy to raise an exception when appending a duplicate persistent object that is already mapped in a relationship?

2016-12-07 Thread 'dcs3spp' via sqlalchemy
Hi, Have tried code sample and it does indeed throw a duplicate :) This is under the condition for 1:m with a fresh object instance created that has a duplicate key id. I have created a smaller example for the scenario I am using. This is based upon the many to many example in the SQLAlchemy d

[sqlalchemy] Re: SQLAlchemy & Teradata

2016-12-06 Thread Mark Sandan
There is also a tutorial here https://developer.teradata.com/tools/articles/teradata-sqlalchemy-introduction It's a hands on way of getting started with SQLAlchemy but using the Teradata Dialect. I wrote it in such a way so that the details of the dialect aren't that significant so hopefully i

Re: [sqlalchemy] Re: SQLAlchemy 1.1.4 - How do I get SQLAlchemy to raise an exception when appending a duplicate persistent object that is already mapped in a relationship?

2016-12-06 Thread 'dcs3spp' via sqlalchemy
Cheers Mike, will give it a go. Thanks again :) Example slightly different in that I am using an association table many to many bi-directional relationship in accordance with documentation at http://docs.sqlalchemy.org/en/latest/orm/basic_relationships.html#many-to-many. Thanks again, Cheers

Re: [sqlalchemy] Re: SQLAlchemy 1.1.4 - How do I get SQLAlchemy to raise an exception when appending a duplicate persistent object that is already mapped in a relationship?

2016-12-06 Thread mike bayer
the formatting of your code is coming out largely unreadable for me, here is a short example illustrating how to get an IntegrityError when appending to a collection. Try running this to confirm it works, and then seeing what's different about your own application versus this example. from s

Re: [sqlalchemy] Re: SQLAlchemy 1.1.4 - How do I get SQLAlchemy to raise an exception when appending a duplicate persistent object that is already mapped in a relationship?

2016-12-06 Thread 'dcs3spp' via sqlalchemy
Hi Mike, Thanks again for responding :) Currently testing with default collection of list. Have also tried previously with set before original post, but still no exception generated. Difference is the set silently ignores duplicates in memory when adding items. Hmmm interesting. Sees t

Re: [sqlalchemy] Re: SQLAlchemy 1.1.4 - How do I get SQLAlchemy to raise an exception when appending a duplicate persistent object that is already mapped in a relationship?

2016-12-06 Thread mike bayer
On 12/06/2016 11:21 AM, 'dcs3spp' via sqlalchemy wrote: Hi, Good suggestion by Mike, regarding possibility that problem could be with postgreSQL. Tried inserting duplicate record in association table from within postgreSQL. This correctly raises a duplicate key error. proposed_coursemanagemen

[sqlalchemy] Re: SQLAlchemy 1.1.4 - How do I get SQLAlchemy to raise an exception when appending a duplicate persistent object that is already mapped in a relationship?

2016-12-06 Thread 'dcs3spp' via sqlalchemy
Hi, Good suggestion by Mike, regarding possibility that problem could be with postgreSQL. Tried inserting duplicate record in association table from within postgreSQL. This correctly raises a duplicate key error. proposed_coursemanagement=> INSERT INTO assignmentoutcome VALUES (1, 1014760, 2,

[sqlalchemy] Re: SQLAlchemy 1.1.4 - How do I get SQLAlchemy to raise an exception when appending a duplicate persistent object that is already mapped in a relationship?

2016-12-06 Thread 'dcs3spp' via sqlalchemy
Hi Mike, Thanks for response. I do have the use of the UniqueConstraint in the association table included below. Any other suggestions? assignmentoutcomeallocation = Table('assignmentoutcome', Base.metadata, Column('CourseID', BigInteger, primary_key=True), Column('UnitID', Integer, pr

[sqlalchemy] Re: SQLAlchemy - Bulk update using sqlalchemy core table.update() expects all columns in the values data

2016-09-28 Thread Rajesh Rolo
Mike, Thanx for your reply. I'll try out the 3rd option. It would still be better than updating record by record at object level. Thanx, Rajesh On Wednesday, September 28, 2016 at 1:59:38 PM UTC+5:30, Rajesh Rolo wrote: > > I'm trying to do a bulk update using core SQLAlchemy to a postgres >

[sqlalchemy] Re: SQLAlchemy - Bulk update using sqlalchemy core table.update() expects all columns in the values data

2016-09-28 Thread Seth P
Oops, I missed that this is an UPDATE rather than an INSERT. Setting the missing columns to None probably isn't what you want. On Wednesday, September 28, 2016 at 9:08:00 AM UTC-4, Seth P wrote: > > Can't you include the missing columns in your dictionary with None values? > -- You received thi

[sqlalchemy] Re: SQLAlchemy - Bulk update using sqlalchemy core table.update() expects all columns in the values data

2016-09-28 Thread Seth P
Can't you include the missing columns in your dictionary with None values? -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com.

Re: [sqlalchemy] Re: SQLAlchemy 1.0.13 released

2016-05-19 Thread Jonathan Vanasco
I rarely think in terms of hits anymore, just free memory and cpu. Apache is still a bit too greedy for me, so I prefer to offload onto a cdn and or use nginx to free up resources. -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe f

Re: [sqlalchemy] Re: SQLAlchemy 1.0.13 released

2016-05-17 Thread Mike Bayer
well now that I'm self-hosting I would maybe need to consider that, though the aggregate number of web hits is not that unmanageable. It's not the delivery of the HTML that's been the problem, it's running the sphinx "make html" that fails on RTD due to memory / time limits. On 05/17/2016 08:

Re: [sqlalchemy] Re: SQLAlchemy 1.0.13 released

2016-05-17 Thread Jonathan Vanasco
Have you thought about using cloudflare to cache the docs? -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to th

Re: [sqlalchemy] Re: SQLAlchemy 1.0.13 released

2016-05-17 Thread Mike Bayer
apparently because my build is some kind of "large" build I was on some special alternate server list, and that whole thing went down, and then it's down for a week and nobody over there gets emails or anything about it. I've had a lot of these outages (e.g. the kind that go on for weeks and t

[sqlalchemy] Re: SQLAlchemy 1.0.13 released

2016-05-17 Thread Jonathan Vanasco
On Monday, May 16, 2016 at 5:31:25 PM UTC-4, Mike Bayer wrote: > > Apparently, readthedocs has been not building for over a week, so at the > moment the CHANGES link below is very stale. We are trying to get RTD > to respond for help. > Last month they had a big change and migrated projects

  1   2   3   4   5   6   7   8   9   >