SQLAlchemy update if unique key exists

From version 1.2 SQLAlchemy will support on_duplicate_key_update for MySQL There is also examples of how to use it: from sqlalchemy.dialects.mysql import insert insert_stmt = insert(my_table).values( id=’some_existing_id’, data=”inserted value”) on_duplicate_key_stmt = insert_stmt.on_duplicate_key_update( data=insert_stmt.values.data, status=”U” ) conn.execute(on_duplicate_key_stmt) From version 1.1 SQLAlchemy support on_conflict_do_update for PostgreSQL Examples: from sqlalchemy.dialects.postgresql import insert insert_stmt = insert(my_table).values( id=’some_existing_id’, data=”inserted value”) do_update_stmt … Read more

SQLAlchemy: a better way for update with declarative?

There’s also some update capability at the ORM level. It doesn’t handle any tricky cases yet but for the trivial case of single row update (or bulk update) it works fine. It even goes over any already loaded objects and applies the update on them also. You can use it like this: session.query(User).filter_by(id=123).update({“name”: u”Bob Marley”})

suggestions for declarative GUI programming in Java

You might have a look at javabuilders; it uses YAML to build Swing UIs. A simple example from the manual [PDF]: JFrame: name: myFrame title: My Frame content: – JLabel: name: myLabel2 text: My First Label – JLabel: name: myLabel2 text: My Second Label Alternatively: JFrame: name: myFrame title: My Frame content: – JLabel: {name: … Read more

WPF without XAML

I support you in Xaml-free WPF. I love layout and binding capabilities of WPF but I hate XAML too. I would love that WPF could be written in plain C#, some advantages: Object and Collection initializers could replace Xaml instantiations. (it’s a pity that xaml prefers top-down than button up). Binding converters could be just … Read more

Very simple, terse and easy GUI programming “frameworks” [closed]

Not to kid, but HTML. It’s cross-platform, and sums up the gui-layout in a simple textfile. It’s definitely mature, as well as well-understood and well documented. There’s a bunch of ways to template HTML files for dynamic content, and other ways to convert custom syntaxes to HTML if you dislike angle-brackets. Client-side scripting w/ Javascript, … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)