[sqlalchemy] limiting reflect and automap to single schema only

2022-05-12 Thread mdob
Hi Everyone, SQLAlchemy nicely reflects tables and builds model using automap. When providing the parameter shema to reflect, tables from that schema are discovered. I've noticed that tables from other schemas will also be included if there is a foreign key to the other schema. It's all

[sqlalchemy] boud parameter to NCHAR column in Oracle

2019-10-03 Thread mdob
Hi everyone, There's IMO unusual behavior in Oracle when using bound parameters on NCHAR column. from sqlalchemy import create_engine from sqlalchemy.sql import text e = create_engine('oracle://chinook:p4ssw0rd@localhost/xe') result = e.execute( text("select * from nchartable where id

[sqlalchemy] why MySQL DOUBLE is asdecimal=True by default

2019-04-29 Thread mdob
Just out of curiosity, why it was decided that MySQL DOUBLE, which is approximation, will be presented in ORM as Decimal by default instead of float? MySQL DOUBLE - https://dev.mysql.com/doc/refman/5.5/en/floating-point-types.html SQLAlchemy DOUBLE -

[sqlalchemy] binding parameters in quotes

2019-03-20 Thread mdob
Hi, Is it correct behavior that parameter placeholders *in quotes* e.g. SELECT * FROM Artist WHERE Name LIKE "%:pattern%" are recognized as valid parameters? from sqlalchemy.sql import text from sqlalchemy.dialects import sqlite from sqlalchemy import create_engine engine =

[sqlalchemy] raw sql execute and engine convert_unicode

2018-12-21 Thread mdob
Hi, I was looking into create_engine options enocding and convert_unicode and it seems it works for ORM but not for executing raw sql. Is that intentional or I'm missing something? from sqlalchemy import create_engine from sqlalchemy.orm import Session from sqlalchemy.ext.automap import

[sqlalchemy] StatementError _exec_default() takes exactly 3 arguments (4 given) since version 1.2.0b3

2018-05-30 Thread mdob
Hi, I've upgraded SQLAlchemy from 1.0.18 to latest 1.2.8 and I get errors that _exec_default() received wrong number of parameters. I've pinpointed that problem appears since version 1.2.0b3. Looks like inside method get_insert_default

[sqlalchemy] automap multithreading

2017-11-22 Thread mdob
Hi SQLAlchemy Group, I've been experimenting with automap (in SQLAlchemy 1.0.20) a bit and I wonder how safe is to automap multiple databases in threads because I run into random errors of classes not being mapped: One or more mappers failed to initialize - can't proceed with initialization

[sqlalchemy] complex primary key with server_default timestamp

2017-05-15 Thread mdob
Just curious. Let's say we have a complex primary key of user_id (integer), project_id (integer) and date (timestamp). After adding and committing we don't have the PK and we won't be able to update it. Is that right? If it was auto-increment integer then it would probably be fine. PK would be

[sqlalchemy] Re: orm add() or table insert() without implicit_returning

2016-08-10 Thread mdob
Me again. Just wanted to say that engine = create_engine(connstr, implicit_returning=False, use_scope_identity =True, echo=True) actually works as expected. I was able to add new objects without select permission on table :) On Wednesday, August 10, 2016 at 5:33:30 PM UTC+2, mdob wrote

[sqlalchemy] orm add() or table insert() without implicit_returning

2016-08-10 Thread mdob
Hi Everyone, How to save new objects to database without SELECT permission on the table? I tried using implicit_returning and use_scope_identity in create_engine. engine = create_engine(connstr, implicit_returning=False, use_scope_identity =False, echo=True) db_session = sessionmaker(engine)()

Re: [sqlalchemy] skipping MSSQL TIMESTAMP column on INSERT

2015-12-11 Thread mdob
, you can set this default up automatically using the > column_reflect event: > > > http://docs.sqlalchemy.org/en/rel_0_9/core/events.html?highlight=column_reflect#sqlalchemy.events.DDLEvents.column_reflect > > as you receive events here, look at the “type” to see if its T

Re: [sqlalchemy] skipping MSSQL TIMESTAMP column on INSERT

2015-12-11 Thread mdob
11, 2015 at 7:12:31 PM UTC+1, mdob wrote: > > > @event.listens_for(Table, 'column_reflect') > def receive_column_reflect(inspector, table, column_info): > if isinstance(column_info['type'], TIMESTAMP): > column_info['default'] = FetchedValue() > > > > tabl

[sqlalchemy] control over metadata reflect

2015-12-10 Thread mdob
metadata = MetaData() metadata.reflect(engine) Base = automap_base(metadata=metadata) Base.prepare() That did a real nice job but I wanted to skip some columns from being mapped (binary types actually at the moment) I see metadata.tables['TableName'].columns to be ImmutableColumnCollection so

[sqlalchemy] Re: control over metadata reflect

2015-12-10 Thread mdob
which takes empty tuple as default https://github.com/zzzeek/sqlalchemy/blob/master/lib/sqlalchemy/sql/schema.py#L484 On Thursday, December 10, 2015 at 10:57:03 AM UTC+1, mdob wrote: > > metadata = MetaData() > metadata.reflect(engine) > > Base = automap_base(metadata=metadata)

[sqlalchemy] Re: control over metadata reflect

2015-12-10 Thread mdob
output of insp.reflecttable it would be a way to ease that. Zzzeek, what do you think about it? Does it make sense? On Thursday, December 10, 2015 at 10:57:03 AM UTC+1, mdob wrote: > > metadata = MetaData() > metadata.reflect(engine) > > Base = automap_base(metadata=metadata)

[sqlalchemy] sqlite filter datetime

2015-06-04 Thread mdob
Hi, It seems I have different result when filtering sqlite database on datetime column. I don't get any results when filtering declarative way Invoice.InvoiceDate == datetime.datetime(2007, 01, 01) same when hen executing raw query with engine.execute 'select * from Invoice where InvoiceDate

Re: [sqlalchemy] sqlite filter datetime

2015-06-04 Thread mdob
far no luck but is it right approach for that problem? Thanks, Mike On Thursday, June 4, 2015 at 1:50:58 PM UTC-4, Michael Bayer wrote: On 6/4/15 11:57 AM, mdob wrote: Hi, It seems I have different result when filtering sqlite database on datetime column. I don't get any

[sqlalchemy] Re: skipping MSSQL TIMESTAMP column on INSERT

2014-11-14 Thread mdob
Hi, It's been some time since this topic was created. Has anything changed on that matter or manually setting column.server_default=FetchedValue() is still the best way to do it? Kind regards, Michał On Thursday, September 15, 2011 7:58:49 AM UTC+2, Matt Bodman wrote: Hi, I am

[sqlalchemy] calchipan

2014-10-25 Thread mdob
Hi, I was trying to use SQLAlchemy with Pandas - CALCHIPAN. Installed sqlalchemy, numpy and pandas from pip, then calchipan from source. SQLAlchemy==0.9.8 argparse==1.2.1 calchipan==0.1.0dev ipython==2.3.0 numpy==1.9.0 pandas==0.15.0 python-dateutil==2.2 pytz==2014.7 six==1.8.0 wsgiref==0.1.2

[sqlalchemy] oracle reflect with duplicated tables (schema casing)

2013-07-24 Thread mdob
Hi, I got into an interesting issue where I receive duplicated tables if I use capital letters schema in reflect method. Ubuntu 12.04 with packages oracle-instantclient11.2-basiclite-11.2.0.3.0-1.i386.rpm, oracle-instantclient11.2-devel-11.2.0.3.0-1.i386.rpm,

[sqlalchemy] Seemingly unnecessary queries for object already in the session get executed when using create_eager option.

2011-05-25 Thread mdob
Consider a simple model like this: Library 1---* Shelf 1---* Book Accordingly our model has the following relationships declared: {tu wkelj kod z relationship wlaczajac backrefy) We will write a query with a join to get all three objects at once SELECT * FROM Library JOIN Shelf ON Library.id