Re: [sqlalchemy] SQLAlchemy lock-up when logging to a database

2018-02-23 Thread Stefan Schwarzer
though.) Best regards, Stefan -- 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 th

Re: [sqlalchemy] SQLAlchemy lock-up when logging to a database

2018-02-21 Thread Stefan Schwarzer
the insert statement in `_emit`. I didn't think of this when I posted the original question, so I could have left out the mutex stuff for the sake of the example code. Best regards, Stefan -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To po

[sqlalchemy] SQLAlchemy lock-up when logging to a database

2018-02-21 Thread Stefan Schwarzer
t nothing was logged to the database when `engine.connect` is called for the first time). Our current workaround is to make sure that at least one connection is created before the first log call happens. The above code does this in `DatabaseHandler.__init__` (commented out). If you uncomment the `with` b

Re: [sqlalchemy] Inserting Chinese characters in Oracle database

2018-01-16 Thread Stefan Schwarzer
Hi Mike, thanks again! On 2018-01-15 23:17, Mike Bayer wrote: > On Mon, Jan 15, 2018 at 3:18 PM, Stefan Schwarzer > <sschwar...@sschwarzer.net> wrote: >> On 2018-01-12 16:33, Mike Bayer wrote:> On Fri, Jan 12, 2018 at 7:14 AM, >> Stefan Schwarzer >>&g

Re: [sqlalchemy] Inserting Chinese characters in Oracle database

2018-01-15 Thread Stefan Schwarzer
On 2018-01-12 16:33, Mike Bayer wrote:> On Fri, Jan 12, 2018 at 7:14 AM, Stefan Schwarzer > <sschwar...@sschwarzer.net> wrote: > In SQLAlchemy 1.1 series and earlier, you can specify > exclude_setinputsizes=() to have STRING be part of the automatic > setinputsizes cal

Re: [sqlalchemy] Inserting Chinese characters in Oracle database

2018-01-12 Thread Stefan Schwarzer
Mike, many thanks for your feedback! On 2018-01-12 16:33, Mike Bayer wrote: > On Fri, Jan 12, 2018 at 7:14 AM, Stefan Schwarzer > <sschwar...@sschwarzer.net> wrote: >> I have trouble inserting Chinese characters into an Oracle database with >> SQLAlchemy (and to some e

[sqlalchemy] Inserting Chinese characters in Oracle database

2018-01-12 Thread Stefan Schwarzer
e two characters are encoded in UTF-8 to one byte each whereas the Chinese characters are encoded to several bytes each. Should the above code for SQLAlchemy work as-is and insert the Chinese charaters (I expected it)? Is there a workaround for now to have SQLAlchemy insert the correct characters?

[sqlalchemy] Regression for sub-second precision when inserting timestamps into Oracle database

2018-01-08 Thread Stefan Schwarzer
org/zzzeek/sqlalchemy/issues/604/oracle-sub-second-timestamp-handling "Related" in the sense that they describe or refer to what presumably must be done to get the sub-second precision upon insertion. Then again, these tickets are old, but I wanted to mention them in case they help. Be

Re: [sqlalchemy] Set column collation only if driver == 'mysql'

2017-08-14 Thread Stefan Scherfke
Am Montag, 14. August 2017 15:12:19 UTC+2 schrieb Mike Bayer: > > we have the with_variant() method which should get you through this: > > > http://docs.sqlalchemy.org/en/latest/core/type_api.html?highlight=variant#sqlalchemy.types.TypeEngine.with_variant > > > in fact the example right there

[sqlalchemy] Set column collation only if driver == 'mysql'

2017-08-14 Thread Stefan Scherfke
?) Using an if-else-Statement on module level *nearly* works, but with this I still can't use pytest.monkeypatch. Cheers, Stefan -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete

Re: [sqlalchemy] full outer join?

2015-04-17 Thread Stefan Urbanek
, unnecessarily overcomplicates statements. Stefan On Monday, December 2, 2013 at 8:09:14 PM UTC-5, Michael Bayer wrote: if someone wants to pullreq the kw argument “full=True” on .outerjoin(), if it’s done effectively I won’t reject it. On Dec 2, 2013, at 5:43 PM, Jonathan Vanasco jona

[sqlalchemy] Referencing DELETE table from nested statement

2014-12-03 Thread Stefan Urbanek
, Stefan -- 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 this group, send email to sqlalchemy@googlegroups.com. Visit

Re: [sqlalchemy] Referencing DELETE table from nested statement

2014-12-03 Thread Stefan Urbanek
, not in the EXISTS portion. See my 'condition' for 'promary' in my example above (there is one stray line, that should be ignored). Or how do you meant to use the the exists() construct? Stefan On Wednesday, December 3, 2014 2:05:32 PM UTC-5, Michael Bayer wrote: why don’t you use a NOT EXISTS correlated

[sqlalchemy] Relative month in date arithmetic

2014-12-01 Thread Stefan Urbanek
Hi, How can I specify relative date on a column where the component is a month? Something like date_column - interval '3 months' The python `timedelta()` does not contain the month component. Cheers, Stefan -- You received this message because you are subscribed to the Google Groups

[sqlalchemy] Passing a dict as JSON argument to a custom Postgres function

2014-08-22 Thread Stefan Urbanek
) table.update().values(a_json_column=value) It fails with: sqlalchemy.exc.ProgrammingError: (ProgrammingError) can't adapt type 'dict' What am I missing? Thanks, Stefan -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from

[sqlalchemy] Re: Passing a dict as JSON argument to a custom Postgres function

2014-08-22 Thread Stefan Urbanek
of a custom function? On Friday, August 22, 2014 11:50:01 AM UTC-4, Stefan Urbanek wrote: Hi, I have a custom PostgreSQL function that takes two JSON-type arguments: CREATE OR REPLACE FUNCTION update_json(original json, update_obj json) When I try to use the function in sqlalchemy

Re: [sqlalchemy] Unable to multi-insert records with SQL functions

2014-06-04 Thread Stefan Urbanek
= table.insert().values(data) print stmt Thanks a lot for the help. Stefan On Jun 3, 2014, at 5:40 PM, Stefan Urbanek stefan@gmail.com javascript: wrote: Hi, I'm trying to multi-insert records which contain a function: record = { some_date: sql.func.now() key

[sqlalchemy] Unable to multi-insert records with SQL functions

2014-06-03 Thread Stefan Urbanek
might be wrong? Stefan -- 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 this group, send email to sqlalchemy

[sqlalchemy] Re: Unable to multi-insert records with SQL functions

2014-06-03 Thread Stefan Urbanek
Postgres. On Tuesday, June 3, 2014 5:44:16 PM UTC-4, Jonathan Vanasco wrote: Which database are you using? -- 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] Re: Unable to multi-insert records with SQL functions

2014-06-03 Thread Stefan Urbanek
3, 2014 5:40:38 PM UTC-4, Stefan Urbanek wrote: Hi, I'm trying to multi-insert records which contain a function: record = { some_date: sql.func.now() key: value, ... } When I execute table insert with list of records where len(records) 1 then I get an error

[sqlalchemy] Cubes OLAP 1.0alpha with new SQL backend features

2014-01-07 Thread Stefan Urbanek
, Stefan -- 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 this group, send email to sqlalchemy@googlegroups.com

[sqlalchemy] How to get server or dialect version or properties?

2013-04-13 Thread Stefan Urbanek
AS SELECT ... except ProgrammingError: CREATE TABLE AS SELECT ... Are there any other options that would not require additional configuration variable on user's side? Regards, Stefan -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe

Re: [sqlalchemy] How to get server or dialect version or properties?

2013-04-13 Thread Stefan Urbanek
Thank you, this solves my problem. On Saturday, April 13, 2013 2:53:15 PM UTC-5, Michael Bayer wrote: there should be engine.dialect.server_version_info available, once at least one connection has been made. On Apr 13, 2013, at 12:26 PM, Stefan Urbanek stefan@gmail.comjavascript

[sqlalchemy] Problem with inserting multiple rows as lists/tuples

2012-12-27 Thread Stefan Urbanek
rows as list of values? Stefan p.s.: I do not know much about SQLAlchemy internals, but the offending code: distilled_params = _distill_params(multiparams, params) if distilled_params: keys = distilled_params[0].keys() else: keys = [] expects

Re: [sqlalchemy] Problem with inserting multiple rows as lists/tuples

2012-12-27 Thread Stefan Urbanek
On 27.12.2012, at 23:21, Michael Bayer mike...@zzzcomputing.com wrote: On Dec 27, 2012, at 4:55 PM, Stefan Urbanek wrote: Hi, I am trying to pass multiple rows as tuples into an INSERT statement.: # buffer is list of lists/tuples, like: [ [1, foo], [2, bar], ... ] insert

Re: [sqlalchemy] How to quote table and schema without Table object?

2012-10-22 Thread Stefan Urbanek
Thanks. So it would be safe to do it as: table_ref = %s.%s % (preparer.quote(schema_name, None), preparer.quote(table_name, None)) to make: a schema.a table? Can I assume that this syntax same for all dialects? Stefan On Monday, October 22, 2012 9:50:14 AM UTC-5, Michael Bayer wrote

[sqlalchemy] How to quote table and schema without Table object?

2012-10-21 Thread Stefan Urbanek
expect table object. Is there a way how can I get schema.table quoting just from strings? Regards, Stefan -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To view this discussion on the web visit https://groups.google.com/d/msg/sqlalchemy

Re: [sqlalchemy] How to drop a view which is represented by Table instance?

2012-05-07 Thread Stefan Urbanek
my_table.is_view? Stefan On Sunday, May 6, 2012 4:50:33 PM UTC+2, Michael Bayer wrote: there's a recipe for views, including DDL, here: http://www.sqlalchemy.org/trac/wiki/UsageRecipes/Views another way to go would be to alter the compilation of sqlalchemy.schema.DropTable which would somehow

Re: [sqlalchemy] How to drop a view which is represented by Table instance?

2012-05-07 Thread Stefan Urbanek
On 7.5.2012, at 20:27, Michael Bayer wrote: On May 7, 2012, at 2:03 PM, Stefan Urbanek wrote: Thanks, this is partially helpful. However, in the example there is: stuff_view = view(stuff_view... and not: stuff_view = Table(stuff_view... My problem is, that I get just a name

Re: [sqlalchemy] How to drop a view which is represented by Table instance?

2012-05-07 Thread Stefan Urbanek
On 8.5.2012, at 0:18, Michael Bayer wrote: On May 7, 2012, at 6:09 PM, Stefan Urbanek wrote: p.s.: On the other hand, Table.is_view might be a good flag - to maintain consistency with the fact that Table() can reflect a view. However, I am not sure how does that fit into overall

[sqlalchemy] How to drop a view which is represented by Table instance?

2012-05-06 Thread Stefan Urbanek
, is there a way how I can at least determine whether the Table object is a view and issue manual DROP VIEW statement by myself? Stefan Urbanek -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To view this discussion on the web visit https

Re: [sqlalchemy] SQLite problem: column aliases with dot are stripped

2012-04-29 Thread Stefan Urbanek
On 28.4.2012, at 18:39, Michael Bayer wrote: On Apr 28, 2012, at 5:52 AM, Stefan Urbanek wrote: This is what I used as workaround [1]: # select is sqlalchemy.sql.expression.select() # each selected column was derived as column = table.c[reference].label(label_with_dot

Re: [sqlalchemy] SQLite problem: column aliases with dot are stripped

2012-04-28 Thread Stefan Urbanek
see no reason why it should not. patch snipped Regards, Stefan [1] https://github.com/Stiivi/cubes/blob/master/cubes/backends/sql/star.py#L126 On Apr 27, 2012, at 2:24 AM, Stefan Urbanek wrote: Hi, I had this problem ~year ago (see [1]). Now with SQLAlchemy 0.7.6 I am having this same

[sqlalchemy] SQLite problem: column aliases with dot are stripped

2012-04-27 Thread Stefan Urbanek
. Is there any workaround for this issue? Thanks for any hints, Stefan [1] http://bit.ly/Je8V4I Selecting columns with dots in their names -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To view this discussion on the web visit https

[sqlalchemy] How to get DDL string from metadata?

2012-04-24 Thread Stefan Urbanek
, Integer)) table.append_column(Column(name, String)) Now I would like to get the CREATE TABLE ... string that I would like to store/use somewhere else. How can I do that? Thanks for any hints, Stefan -- You received this message because you are subscribed to the Google Groups sqlalchemy

Re: [sqlalchemy] How to get DDL string from metadata?

2012-04-24 Thread Stefan Urbanek
Thank you very much, seems to work as I wanted. By the way, you are using executor=function in create_engine. I do not see it in the documentation [1]. Is it just missing in the docs or it is a private parameter? Regards, Stefan [1] http://docs.sqlalchemy.org/en/latest/core/engines.html

[sqlalchemy] One to Many relationship of the same class as the parent class

2012-03-05 Thread Stefan
) password = db.Column(db.String(30)) friends = db.relationship(Friend, secondary=association_table) Basically I want to have a relationship to other objects of class User in the field User.friends What am I doing wrong here? Thanks, Stefan -- You received this message

[sqlalchemy] Re: One to Many relationship of the same class as the parent class

2012-03-05 Thread Stefan
','2')] user1.friends[0].added_by [User('admin','ad...@admin.com','1')] On Monday, 5 March 2012 15:54:27 UTC, Stefan wrote: I have been struggeling for a few days with this now and trying to see if I maybe can get some help here. I'm using SQLAlchemy with Flask This is what I have tried

[sqlalchemy] When creating many-to-many relationship I get: NoReferencedTableError

2012-02-08 Thread Stefan Urbanek
schema. What I am doing wrong? Thanks, Stefan -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com

[sqlalchemy] Re: When creating many-to-many relationship I get: NoReferencedTableError

2012-02-08 Thread Stefan Urbanek
Yes, I've tried that. It does not help. Btw. isn't the whole thing executed/resolved on base.metadata.create_all(engine)? Stefan On Feb 9, 12:24 am, Jackson, Cameron cameron.jack...@thalesgroup.com.au wrote: Have you tried changing the order so that Card is defined before collection_cards

[sqlalchemy] Cubes OLAP: Examples for SQL backend

2011-11-28 Thread Stefan Urbanek
decisions and bugs). Regards, Stefan Urbanek data analyst and data brewmaster Twitter: @Stiivi Home: http://stiivi.com Brewery: http://databrewery.org Github: https://github.com/Stiivi -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post

[sqlalchemy] sqlalchemy could not determine dialect when used with py2app

2011-05-18 Thread Stefan Urbanek
try? Regards, Stefan -- Data Brewery: http://databrewery.org -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr

[sqlalchemy] Selecting columns with dots in their names

2011-03-02 Thread Stefan Urbanek
to be passed to the select() to return full column names? Regards, Stefan -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy

[sqlalchemy] Re: Selecting columns with dots in their names

2011-03-02 Thread Stefan Urbanek
I apologize for replying to my own post, just found out that it works as expected with the latest fresh release 0.7b2 -downloaded and installed manually. it does not work with the version installed by easy_install, i think it was 0.6.6. On Mar 3, 12:18 am, Stefan Urbanek stefan.urba...@gmail.com

[sqlalchemy] Brewery: Heterogenous data streams with SQL Alchemy

2011-01-21 Thread Stefan Urbanek
you have any suggestions, comments? If anyone would like to try it and will have any troubles, just drop me a line and I will help. Regards, Stefan Urbanek -- Twitter: @Stiivi -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group

[sqlalchemy] Using Inspector with oracle+zxjdbc

2010-06-11 Thread Witzel, Stefan
Hello, I'm trying to retrieve some column properties from a oracle database using oracle+zxjdbc: jdbcUrl = '%(engine_dialect)s://%(username)s:%(password)s...@%(hostname)s:%(port)d/%(data base)s' % connection engine = sa.create_engine(jdbcUrl) inspector = sa.engine.reflection.Inspector(engine)

[sqlalchemy] Re: Again MySQL/unicode - roundtrip failed

2006-12-15 Thread Stefan Meretz
Am I right? Here's the bug I filed: http://sourceforge.net/tracker/index.php?func=detailaid=1592353grou p_id=22307atid=374932 If I am right, I would add a note to the bug you already filed. Thanks, Stefan -- Start here: www.meretz.de

[sqlalchemy] Re: Again MySQL/unicode - roundtrip failed

2006-12-12 Thread Stefan Meretz
() Why is the engine saying: (...) UPDATE testtable SET test=%s WHERE testtable.pkey = %s (...) ['s\xc3\xbcd!', 'first'] Shouldn't it look like this: (...) UPDATE testtable SET test=%s WHERE testtable.pkey = %s (...) [u's\xfcd!', 'first'] Ciao, Stefan -- Start here: www.meretz.de