简体   繁体   English

在脚本中从FileMaker Pro数据库中提取数据的最佳方法?

[英]Best way to extract data from a FileMaker Pro database in a script?

My job would be easier, or at least less tedious if I could come up with an automated way (preferably in a Python script) to extract useful information from a FileMaker Pro database. 如果我能够以自动方式(最好是在Python脚本中)从FileMaker Pro数据库中提取有用信息,我的工作会更容易,或者至少不那么繁琐。 I am working on Linux machine and the FileMaker database is on the same LAN running on an OS X machine. 我正在使用Linux机器,FileMaker数据库位于OS X机器上运行的同一LAN上。 I can log into the webby interface from my machine. 我可以从我的机器登录webby界面。

I'm quite handy with SQL, and if somebody could point me to some FileMaker plug-in that could give me SQL access to the data within FileMaker, I would be pleased as punch. 我对SQL非常方便,如果有人能指出一些可以让我对FileMaker中的数据进行SQL访问的FileMaker插件,我会很高兴。 Everything I've found only goes the other way: Having FileMaker get data from SQL sources. 我发现的一切只有另一种方式:让FileMaker从SQL源获取数据。 Not useful. 没有用。

It's not my first choice, but I'd use Perl instead of Python if there was a Perl-y solution at hand. 这不是我的第一选择,但如果手头有Perl-y解决方案,我会使用Perl而不是Python。

Note : XML/XSLT services (as suggested by some folks) are only available on FM Server, not FM Pro. 注意 :XML / XSLT服务(如某些人所建议的)仅适用于FM Server,而不适用于FM Pro。 Otherwise, that would probably be the best solution. 否则,这可能是最好的解决方案。 ODBC is turning out to be extremely difficult to even get working. ODBC变得非常难以开始工作。 There is absolutely zero feedback from FM when you set it up so you have to dig through /var/log/system.log and parse obscure error messages. 设置时,FM绝对没有反馈,因此您必须深入了解/var/log/system.log并解析模糊的错误消息。

Conclusion : I got it working by running a python script locally on the machine that queries the FM database through the ODBC connections. 结论 :我通过在通过ODBC连接查询FM数据库的机器上本地运行python脚本来实现它。 The script is actually a TCPServer that accepts socket connections from other systems on the LAN, runs the queries, and returns the data through the socket connection. 该脚本实际上是一个TCPServer,它接受来自LAN上其他系统的套接字连接,运行查询,并通过套接字连接返回数据。 I had to do this to bypass the fact that FM Pro only accepts ODBC connections locally (FM server is required for external connections). 我必须这样做才能绕过FM Pro仅在本地接受ODBC连接这一事实(外部连接需要FM服务器)。

It has been a really long time since I did anything with FileMaker Pro, but I know that it does have capabilities for an ODBC (and JDBC) connection to be made to it (however, I don't know how, or if, that translates to the linux/perl/python world though). 我用FileMaker Pro做了长时间,但我知道它确实具有与ODBC(和JDBC)连接的功能(但是,我不知道如何,或者如果,虽然转换为linux / perl / python世界。

This article shows how to share/expose your FileMaker data via ODBC & JDBC: 本文介绍如何通过ODBC和JDBC共享/公开您的FileMaker数据:
Sharing FileMaker Pro data via ODBC or JDBC 通过ODBC或JDBC共享FileMaker Pro数据

From there, if you're able to create an ODBC/JDBC connection you could query out data as needed. 从那里,如果您能够创建ODBC / JDBC连接,则可以根据需要查询数据。

You'll need the FileMaker Pro installation CD to get the drivers. 您需要FileMaker Pro安装CD才能获得驱动程序。 This document details the process for FMP 9 - it is similar for versions 7.x and 8.x as well. 本文档详细介绍了FMP 9的过程 - 它与版本7.x和8.x类似。 Versions 6.x and earlier are completely different and I wouldn't bother trying (xDBC support in those previous versions is "minimal" at best). 版本6.x和更早版本是完全不同的,我不打扰尝试(在那些以前的版本中的xDBC支持最多是“最小”)。

FMP 9 supports SQL-92 standard syntax (mostly). FMP 9支持SQL-92标准语法(主要是)。 Note that rather than querying tables directly you query using the "table occurrence" name which serves as a table alias of sorts. 请注意,不是直接查询表,而是使用“表格出现”名称进行查询,该名称用作排序的表别名。 If the data tables are stored in multiple files it is possible to create a single FMP file with table occurrences/aliases pointing to those data tables. 如果数据表存储在多个文件中,则可以创建单个FMP文件,其中表出现/别名指向这些数据表。 There's an "undocumented feature" where such a file must have a table defined in it as well and that table "related" to any other table on the relationships graph (doesn't matter which one) for ODBC access to work. 有一个“未记录的功能”,其中这样的文件也必须在其中定义一个表,并且该表与关系图上的任何其他表“相关”(无关紧要),以便ODBC访问工作。 Otherwise your queries will always return no results. 否则,您的查询将始终不返回任何结果。

The PDF document details all of the limitations of using the xDBC interface FMP provides. PDF文档详细说明了使用FMP提供的xDBC接口的所有限制。 Performance of simple queries is reasonably fast, ymmv. 简单查询的性能相当快,ymmv。 I have found the performance of queries specifying the "LIKE" operator to be less than stellar. 我发现查询的性能指定“LIKE”运算符小于恒星。

FMP also has an XML/XSLT interface that you can use to query FMP data over an HTTP connection. FMP还有一个XML / XSLT接口,可用于通过HTTP连接查询FMP数据。 It also provides a PHP class for accessing and using FMP data in web applications. 它还提供了一个PHP类,用于在Web应用程序中访问和使用FMP数据。

If your leaning is to Python, you may be interested in checking out the Python Wrapper for Filemaker. 如果你倾向于Python,你可能会对查看Filemaker的Python Wrapper感兴趣。 It provides two way access to the Filemaker data via Filemaker's built-in XML services. 它通过Filemaker的内置XML服务提供对Filemaker数据的双向访问。 You can find some quite thorough information on this at: 您可以在以下网址找到一些相关详尽的信息:

http://code.google.com/p/pyfilemaker/ http://code.google.com/p/pyfilemaker/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM