sqlobject

OCP换题库了,最新052考试题库及答案整理-34

[亡魂溺海] 提交于 2021-02-17 07:21:53
34、Which is true about invalid PL/SQL objects? A) They are automatically recompiled against the new definition of a referenced object at the same time as the referenced object is modified. B) They can be manually recompiled only by using SQL commands. C) They are automatically recompiled against the new definition of a referenced object when they are called. D) They must be manually recompiled before they can be used if a DDL is performed on a table that is referenced in the PL/SQL object. Answer:D 北京CUUG整理,转载请注明,OCP讨论组:569933648/836361015 来源: oschina 链接: https://my.oschina.net/u/3946119/blog

IronPython db-api 2.0

本小妞迷上赌 提交于 2020-01-02 15:25:28
问题 Does anyone know which if any db-api 2.0 drivers work with IronPython? If so, has anyone tried using it with SQLAlchemy, SQLObject or the Django ORM? 回答1: I know this is a very late answer, but I only saw the question today -- so I am answering it today. http://sourceforge.net/projects/adodbapi contains a fully compliant db-api-2 module which works with IronPython. It is restricted to use in Windows, since it uses classic ADO, using COM calls, rather than ADO.NET. [I tried a true .NET version

SQL get data out of BEGIN; …; END; block in python

醉酒当歌 提交于 2019-12-22 18:40:13
问题 I want to run many select queries at once by putting them between BEGIN; END; . I tried the following: cur = connection.cursor() cur.execute(""" BEGIN; SELECT ...; END;""") res = cur.fetchall() However, I get the error: psycopg2.ProgrammingError: no results to fetch How can I actually get data this way? Likewise, if I just have many selects in a row, I only get data back from the latest one. Is there a way to get data out of all of them? 回答1: Postgresql doesn't actually support returning

Python: get escaped SQL string

只谈情不闲聊 提交于 2019-12-22 18:33:20
问题 When I have a cursor, I know I can safely execute a query as follows: cur.execute("SELECT * FROM foo WHERE foo.bar = %s", (important_variable,)) Is there any way to just get the string safely without executing the query? For example, if important_variable is a string, like "foo 'bar' \"baz" , I'd want the appropriately escaped one: "SELECT * FROM foo WHERE foo.bar = "foo \'bar\' \"baz" (or whatever the appropriate escaping is, I'm not even sure). I'm using psycopg, and sqlobject. 回答1: Look at

CONCAT_WS in sqlalchemy?

可紊 提交于 2019-12-12 06:44:59
问题 In my sqlobject implementation I have the following line: members = Member.select("CONCAT_WS(' ', member.first_name, member.last_name, member.personal_code_number, member.mail) like " + Member.sqlrepr('%' + query + '%')) I want to convert that to using sqlalchemy but haven't found a way to do that. 回答1: members = session.query(Member).filter( func.CONCAT_WS(' ', Member.first_name, Member.last_name, Member.personal_code_number, Member.mail) .like('%' + query + '%') ) 来源: https://stackoverflow

Error returned when running imdbpy2sql.py with MySQL database

♀尐吖头ヾ 提交于 2019-12-11 05:12:16
问题 I am working on getting IMDbPY installed and working and I have come to a point where I am working on pulling in all of the data from the flat (text) files in to a (MySQL) database. When I run the appropriate command: imdbpy2sql.py -d /tmp/IMDB/ -u 'mysql://user:password@host/database' I recieve the following error: Traceback (most recent call last): File "/usr/local/bin/imdbpy2sql.py", line 4, in <module> import pkg_resources File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line

Any reasons not to use SQLObject over SQLAlchemy?

我只是一个虾纸丫 提交于 2019-12-10 12:33:03
问题 I don't expect to need much more than basic CRUD type functionality. I know that SQLAlchemy is more flexible, but the syntax etc of sqlobject just seem to be a bit easier to get up and going with. 回答1: I think SQLObject is more pythonic/simpler, so if it works for you, then stick with it. SQLAlchemy takes a little more to learn, but can do more advanced things if you need that. 回答2: Also, you might wanna take a look at elixir, which is a fairly thick wrapper around SQLAlchemy and really makes

Python: get escaped SQL string

不想你离开。 提交于 2019-12-06 09:22:26
When I have a cursor, I know I can safely execute a query as follows: cur.execute("SELECT * FROM foo WHERE foo.bar = %s", (important_variable,)) Is there any way to just get the string safely without executing the query? For example, if important_variable is a string, like "foo 'bar' \"baz" , I'd want the appropriately escaped one: "SELECT * FROM foo WHERE foo.bar = "foo \'bar\' \"baz" (or whatever the appropriate escaping is, I'm not even sure). I'm using psycopg, and sqlobject. Look at the mogrify method for cursors -- it will return the string after variable binding and show any quoting it

IronPython db-api 2.0

十年热恋 提交于 2019-12-06 05:17:39
Does anyone know which if any db-api 2.0 drivers work with IronPython? If so, has anyone tried using it with SQLAlchemy, SQLObject or the Django ORM? I know this is a very late answer, but I only saw the question today -- so I am answering it today. http://sourceforge.net/projects/adodbapi contains a fully compliant db-api-2 module which works with IronPython. It is restricted to use in Windows, since it uses classic ADO, using COM calls, rather than ADO.NET. [I tried a true .NET version, but it worked very poorly. The fork for it is still there if anyone wants to follow up.] A fork of this

Dynamic Order in JDBI SQL Object Queries

半世苍凉 提交于 2019-11-27 14:06:33
How do you do ordering with SQL Object Queries in JDBI? I want to do something like: @SqlQuery( "SELECT * FROM users " + "WHERE something = :something " + "ORDER BY :orderBy :orderDir" ) List<User> getUsers( @Bind("something") Integer something , @BindOrderBy("orderBy") String orderBy , @BindOrderDir("orderDir") String orderDir ); or @SqlQuery( "SELECT * FROM users " + "WHERE something = :something " + "ORDER BY :orderBy :orderDir" ) List<User> getUsers( @Bind("something") Integer something , @Bind("orderBy") OrderBy orderBy , @Bind("orderDir") OrderDir orderDir ); I've recently been exploring