自动将 Sybase .ADT 文件转换为 SQL [英] Automate conversion of Sybase .ADT files to SQL

查看:26
本文介绍了自动将 Sybase .ADT 文件转换为 SQL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在处理我获得的一些数据,这些数据是通过使用嵌入式 Advantage 数据库服务器的程序读取的.该程序不是我编写的,也没有我需要的所有功能.我想将此数据转换为不同的格式,以便我可以更自由地使用它,例如 MySQL.

I am working with some data I obtained that is read with a program using an embedded Advantage Database Server. The program was not written by me and does not have all of the functionality that I need. I would like to convert this data to a different format so that I can work with it more freely, such as MySQL.

我知道 Sybase 提供了一些将单个本地数据库转换为 SQL 的工具,非常好.这将工作正常,除了该程序的作者为用户正在使用的每个新文档创建一个包含新数据库的新文件夹.因此,可能有 100 个单独的数据库文件夹,每个文件夹中都有 100 个 .ADT 文件.

I know that Sybase provides some tools for converting a single local database into SQL, which is very nice. This would work fine, except that the authors of this program create a new folder containing a new database for every new document that a users is working with. So there could be 100s of separate database folders each with 100s of .ADT files in them.

我正在寻找一种方法来自动化将这些 .ADT 文件及其架构转换为其他任何内容的过程.我在过去必须使用的几乎所有其他格式上都有更多的运气,这是最麻烦的.我不需要索引、视图或任何这些.我只需要将表导出为另一种格式,以便我可以处理一些数据.

I am looking for a way to automate the process of converting these .ADT files and their schema to basically anything else. I've had more luck with almost all the other formats I've had to work with in the past, this one has been most troublesome. I don't need indexes, views, or any of that. I only need to export the tables to another format so that I can process some of the data.

所以我在这里寻找的解决方案只是一种将单个 Advantage Database Server 本地数据库自动转换为 SQL 的方法.所以我有一个代表数据库的 .ADT 文件文件夹.

So the solution I'm looking for here is just a way to automate the conversion of a single Advantage Database Server local database to SQL. So I have a folder of .ADT files that represent the database.

我在标签中包含了 Ruby 和 Python,因为使用其中一种脚本语言是理想的,但任何解决方案都会很棒.

I included Ruby and Python in the tags because using one of these scripting languages would be ideal, but any solution would be great.

我现在的路线是尝试使用 ODBC 驱动程序,但我遇到了问题,希望有更简单的解决方案.

The route I'm on right now is trying to work with the ODBC drivers, but I'm having trouble and hoped that there was an easier solution.

谢谢!

蔡斯格雷

推荐答案

经过一番询问和搜索,似乎没有我想要的东西.

After some asking and searching it seems that there isn't something like what I was looking for.

今天早些时候我花了一些时间基于 Ruby DBF gem 将一些东西放在一起.我还没有完成,但它像我想要的那样工作.我将不得不完成测试并添加 SQL 的导出等,但希望其他人能找到这个问题并且可以从 .ADT 文件中检索信息,而无需安装任何东西.

I spent a little while earlier today putting something together based on the Ruby DBF gem. I'm not finished, but it works like I want it to. I'll have to finish up the tests and add the exporting of SQL, etc. but hopefully somebody else finds this question and can retrieve information from a .ADT file without having to install anything.

这是项目的链接.它可能会在晚上剩下的时间里进行.目前它非常少,但随着时间的推移,我可能会添加它.

Here is the link to the project. It'll be in progress for the rest of the night probably. It's pretty minimal right now, but over time I'll probably add to it.

http://github.com/chasemgray/Ruby-ADThttp://chase.ratchetsoftware.com/2010/02/reading-advantage-database-server-files-adt-in-ruby/

现在获取数据应该就这么简单.

Now getting data out should be as simple as this.

require 'adt'

table = ADT::Table.new("test.adt")

table.each do |record|
  puts record.name
  puts record.email
end

感谢您的帮助,

蔡斯格雷

这篇关于自动将 Sybase .ADT 文件转换为 SQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆