declarative

SQLAlchemy - order_by on relationship for join table

ε祈祈猫儿з 提交于 2019-12-03 10:43:55
I'm using declarative SQLAlchemy and I have three models: Role , Permission , and RolePermission . In my Role model, I have the following: class Role(Base): name = Column(u'NAME', VARCHAR(50), nullable=False, unique=True) permissionLinks = relationship(RolePermission, backref="role", order_by=name) permissions = relationship(Permission, backref=backref("roles", order_by=name), secondary=RolePermission.__table__, order_by=Permission.name) Now the permissions declaration works fine, and the permissions associated with a role come out sorted as I expect (by name). However, permissionLinks fails

problem assigning declarative values in asp:hyperlink. error: this is not scriptlet. will output as plain text

蹲街弑〆低调 提交于 2019-12-03 09:57:48
I am trying to do this: <asp:HyperLink NavigateUrl='<%= WebContext.RootUrl %><%= WebContext.CurrentUser.UserName %>' runat="server" Text='<%= GetProfileImage(WebContext.CurrentUser.AccountId) %>'></asp:HyperLink> But am getting the error: this is not scriptlet. will output as plain text. when I mouse over my declarative statements. Any ideas? Thanks. You can use data binding syntax <%# %> . Just be sure that your hyperlink is either in a databound control, such as a ListView item template, or that you explicitly call DataBind() on the control from code-behind. You cannot use <%= ... %>

SQLAlchemy Declarative + relationships across multiple different databases

爱⌒轻易说出口 提交于 2019-12-03 09:05:10
问题 It took me a while, but I figured out how to use SQLAlchemy to model a relationship across two different kinds of databases: Base = declarative_base() class Survey(Base): __tablename__ = 'SURVEY' survey_id = Column("SURVEY_ID", Integer, primary_key=True) term_id = Column("TERM_ID", Integer, nullable=False) # Because the TERM table is in Oracle, but the SURVEY table is in # MySQL, I can't rely on SQLAlchemy's ForeignKey. Thus, # I need to specify the relationship entirely by hand, like so:

How to choose in runtime among several OSGi services in an intelligent way?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-03 07:23:42
I've in mind an intelligent system which can choose among available OSGi services dynamically. That is, choose an implementation or another depending of some runtime parameter. For example, notify to a running algorithm that change an operator after several iterations, or depending of load balancing in a system or whatever. while(stopCriterion){ operator.doSomething(); //There exist many operator implementations } My first approach is to use DS to expose the services and bind services with 0..n and dynamic policy. Then, from an external intelligent component, notify the algorithm which service

What is build-by-convention in Gradle deep explanation?

丶灬走出姿态 提交于 2019-12-03 05:40:52
The Gradle User Guide often mentions that Gradle is declarative and uses build-by-convention . What does this mean? From what I understand it means that, for example, in java plugin there are conventions like source must be in src/main/java ,tests must be in src/main/test , resources in src/main/resources , ready jars in build/libs and so on. However, Gradle does not oblige you to use these conventions and you can change them if you want. But with the second concept, I have a bigger problem with understanding. Like SQL you say what you want to do with your queries but do not say how the

SQLAlchemy Declarative + relationships across multiple different databases

余生长醉 提交于 2019-12-02 23:31:27
It took me a while, but I figured out how to use SQLAlchemy to model a relationship across two different kinds of databases: Base = declarative_base() class Survey(Base): __tablename__ = 'SURVEY' survey_id = Column("SURVEY_ID", Integer, primary_key=True) term_id = Column("TERM_ID", Integer, nullable=False) # Because the TERM table is in Oracle, but the SURVEY table is in # MySQL, I can't rely on SQLAlchemy's ForeignKey. Thus, # I need to specify the relationship entirely by hand, like so: term = relationship("Term", primaryjoin="Term.term_id==Survey.term_id", foreign_keys=[term_id], backref=

Declarative coding or programmatic coding in Dojo Projects? [closed]

五迷三道 提交于 2019-12-01 14:53:24
In my own experience, I like programmatic coding. To name a few benefits at here: Better performance: no need to parse. No switch between html and javascript: no html, everything in code(use css to control layout.) Easy to dynamically change the content. Easy to be read and be maintained. But, it seams a lot of users at here using declarative coding. my question is : what's the benefit to use declarative coding? Which one is dojo gurus' favorite? Like fransisco said, you can seperate your code easier. I mean, if you instantiate all your widgets in your JavaScript code, your JavaScript will

Declarative coding or programmatic coding in Dojo Projects? [closed]

泄露秘密 提交于 2019-12-01 13:34:20
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 5 years ago . In my own experience, I like programmatic coding. To name a few benefits at here: Better performance: no need to parse. No switch between html and javascript: no html, everything in code(use css to control layout.) Easy to dynamically change the content. Easy to be read and

In SQLAlchemy, how do I define an event to fire DDL using declarative syntax?

我怕爱的太早我们不能终老 提交于 2019-11-30 07:36:08
问题 This example shows how to use it with "non-declarative" - http://docs.sqlalchemy.org/en/latest/core/ddl.html#sqlalchemy.schema.DDL How can I use it with the ORM declarative syntax? For example, with this structure: Base = declarative_base(bind=engine) class TableXYZ(Base): __tablename__ = 'tablexyz' 回答1: Silly example, but think this is what you're looking for, should get you going: from sqlalchemy import event from sqlalchemy.engine import create_engine from sqlalchemy.ext.declarative import

SQLAlchemy: a better way for update with declarative?

余生长醉 提交于 2019-11-29 20:46:13
I am a SQLAlchemy noob. Let's say I have an user table in declarative mode: class User(Base): __tablename__ = 'user' id = Column(u'id', Integer(), primary_key=True) name = Column(u'name', String(50)) When I know user's id without object loaded into session, I update such user like this: ex = update(User.__table__).where(User.id==123).values(name=u"Bob Marley") Session.execute(ex) I dislike using User.__table__ , should I stop worrying with that? Is there a better way to do this? Thanks! There's also some update capability at the ORM level. It doesn't handle any tricky cases yet but for the