首页 \ 问答 \ 使用Python的SQl Loader(SQl Loader using Python)

使用Python的SQl Loader(SQl Loader using Python)

我看到SQL Loader表现得非常奇怪。

我在我的终端(Linux)上执行了一个命令

sqlldr username/password@XXXX control=xxx.ctl

上面的命令没有产生任何错误:

Total logical records skipped:          0
Total logical records read:             4
Total logical records rejected:         0
Total logical records discarded:        0 

但是当我在python脚本中使用这个语句时:

subprocess.call('sqlldr USERNAME/PASSWORD3@XXX control=XXX.ctl', shell=True)

我看到没有记录被加载到目标表中:

Total logical records skipped:          0
Total logical records read:             0
Total logical records rejected:         0
Total logical records discarded:        0

关注的是,当我在命令行中运行SQL loader命令时,它表现正常,但不在python脚本中。任何建议请...

谢谢


I see that SQL Loader is behaving quite weird.

I have executed a command on my Terminal(Linux) as

sqlldr username/password@XXXX control=xxx.ctl

The above command didnot produces any errors:

Total logical records skipped:          0
Total logical records read:             4
Total logical records rejected:         0
Total logical records discarded:        0 

but when i used this statement inside python script:

subprocess.call('sqlldr USERNAME/PASSWORD3@XXX control=XXX.ctl', shell=True)

i see no records are been loaded into the target table:

Total logical records skipped:          0
Total logical records read:             0
Total logical records rejected:         0
Total logical records discarded:        0

The concern is that when i run the SQL loader command in commandline it behaves normal, but not within the python script.Any suggestions please..

Thanks


原文:https://stackoverflow.com/questions/30026794
更新时间:2023-03-29 07:03

最满意答案

您需要确保为此测试最常见的故障模式:

  1. DNS查找失败
  2. IP连接失败(一旦DNS查找成功)
  3. 除200以外的HTTP响应
  4. HTTP响应不完整或超时
  5. HTTP响应200但RPC或返回的文档无效

这些只是我可以想到的几种常见的失败模式,它们都会以不同的行为表现出来,您可能希望明确地处理您的应用程序。

如果你在呼叫者和服务之间建立了一个计算机,在它们之间进行路由,你可以清楚地模拟这些故障模式,并修改你的应用程序来处理它们。


You need to be sure to test the most common failure modes for this:

  1. DNS lookup fails
  2. IP connection fails (once DNS lookup succeeds)
  3. HTTP response other than 200
  4. HTTP response incomplete or timeout
  5. HTTP response 200 but RPC or document returned is invalid

Those are just a few common failure modes I could think of that will all manifest themselves with different behaviors that you may wish to have your application handle explicitly.

If you set up a computer between the caller and service that routes between them, you can simulate each of these failure modes distinctly and modify your application to handle them.

相关问答

更多
  • 在技术上可以切换System.in ,但一般来说,它不会直接在代码中调用它,而是添加一层间接,从而从应用程序的一个点控制输入源。 正是这样做是一个实现细节 - 依赖注入的建议是好的,但你不一定需要引入第三方框架; 例如,您可以从调用代码传递一个I / O上下文。 如何切换System.in : String data = "Hello, World!\r\n"; InputStream stdin = System.in; try { System.setIn(new ByteArrayInputStr ...
  • 您可以使用JSONP制作跨域请求。 与jQuery的你可以使用$ .json函数并在URL中指定一个回调,如下所示的jsonp请求: &callback=? 实际上,所有你需要的是问号作为参数值,参数名称可以是任何东西。 只有抓住,是你要求的服务器必须支持jsonp 有关更深入的信息,请参阅此博客文章,了解如何使jsonp与纽约时代的json api一起工作: http://notetodogself.blogspot.com/2009/02/using-jquery-with-nyt-json-api. ...
  • 在处理Web服务时,您不需要使用Jakarta Cactus,并且可以通过编写普通的旧JUnit测试来避开。 测试将采取两种形式: 1.底层功能是否按预期工作? 这与Web服务本身无关,但与其提供的底层功能无关。 例如你的数据访问对象是否正确地检索/处理数据? 希望你的web服务接口和底层功能不紧密结合。 2.实时Web服务(无论是SOAP / REST / XMLRPC)是否正常工作? 在这种情况下,测试此方法的一个好方法是构建Web服务客户端并编写测试以查看此客户端是否可以正确地对Web服务进行工作。 ...
  • 你的应用程序代码不应该有http://otherserver.com硬编码,它应该是可配置的。 在正常运行时,它应该指向http://otherserver.com ,当在测试模式下运行时,它应该指向http://localhost: ,其中是启动Wiremock服务器的地方(最好是动态的避免港口冲突) Your application code should not have the http://otherserver.com hardcoded, it should be co ...
  • 您需要确保为此测试最常见的故障模式: DNS查找失败 IP连接失败(一旦DNS查找成功) 除200以外的HTTP响应 HTTP响应不完整或超时 HTTP响应200但RPC或返回的文档无效 这些只是我可以想到的几种常见的失败模式,它们都会以不同的行为表现出来,您可能希望明确地处理您的应用程序。 如果你在呼叫者和服务之间建立了一个计算机,在它们之间进行路由,你可以清楚地模拟这些故障模式,并修改你的应用程序来处理它们。 You need to be sure to test the most common fai ...
  • 查看http://sumo-sim.org 。 它是一个功能齐全的开源流量模拟。 您可以获得车辆位置的静态跟踪,也可以通过API访问这些值,并在运行的模拟中触发重新路由。 该文档位于http://sumo-sim.org/wiki ,您可以通过sumo-user@lists.sourceforge.net获得帮助。 Check out http://sumo-sim.org. It is a fully featured open source traffic simulation. You can eit ...
  • 如果这不是一个用户流,那么它们应该是单独的功能/方案。 在你已经检查过的测试中多次设置对同一个选择器的期望时,你还需要小心(如果你再次检查它再次出现),否则你最终可能会在他们不应该的时候通过测试。由于时间和异步行为问题。 另外 - 因为您正在检查CSS选择器,您可能希望使用have_css而不是have_selector因为它读取更好并且意味着如果默认选择器类型从以下更改,测试将继续工作:css If this isn't one user flow then they should be separate ...
  • 你可以用Moq或其他动态Mock来做到这一点,但听起来不是一个好主意。 您描述需求的方式听起来就像您希望Web服务包含一些非常重要的逻辑 - 可能不像最终生产Web服务那样复杂的逻辑,但至少是一组启发式规则。 这对我来说听起来很像假而不是模拟 。 简而言之,Fake是依赖项的轻量级实现。 另一方面,模拟提供或多或少的预先固定的静态输入答案,同时验证输入是否是预期的。 这听起来并不像你描述的那样。 简而言之,实现您所描述的内容的最佳方式是编写一个轻量级的Web服务,其行为与您描述的一样。 如果您需要生成一些虚 ...
  • 我找不到比scalatra简单的东西。 虽然主页上的代码非常简单,但您需要做一些额外的工作才能在自己的应用程序/测试中嵌入scalatra。 import org.scalatra._ import org.eclipse.jetty.server.Server import org.eclipse.jetty.webapp.WebAppContext private class Mocker extends ScalatraServlet { get("/somepath") { < ...
  • 使用BDD (行为驱动开发)引入了场景测试。 因此,基本上在测试单个场景时,您大多数时候都会有多个功能测试场景。 场景测试的目的是测试整个场景,BDD主要对其进行推广。 让我试着用一个例子来详细说明。 因此,假设项目遵循BDD,并且要测试的方案通常以接受标准的形式指定,如下所示: 作为经过身份验证的用户,为了提取现金,我应该能够使用ATM。 因此,在这种情况下测试此场景,您需要运行多个功能测试。 列出以下几个: 验证用户 输入有效现金以退出 取现现金 这只是一个流程,并且在这个场景中将涉及需要设计的多个正面 ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)