Re: SQL examples
Re: SQL examples
- Subject: Re: SQL examples
- From: Bruce Robertson <email@hidden>
- Date: Fri, 13 Mar 2009 22:41:13 -0700
>>> The Create SQLite Database action isn't a standard Automator action.
>>> So it would have been handy to know which one you were referring to.
>>> I found one at http://automator.us/developer-02.html#1003, but who's
>>> to keep anyone else from creating an Action with the same name.
>>>
>>> This action's description points out that its expected input is an
>>> AppleScript list, not text or sql. So using it properly will almost
>>> certainly improve your outcome. I toyed around with it and don't see
>>> a lot of benefit to what you are trying to accomplish. Since you will
>>> have a csv file you will know the structure of the data (unless that
>>> is the part you are wanting to automate). I suggest manually creating
>>> the database file and table structure. I have one main database file
>>> that I use in nearly all my sql-related actions and just create new
>>> tables for each new project. I then move it out to MySQL when cleaned
>>> up, processed, etc.
>>
>> Thank you but I would still like an answer to the question I asked.
>>
>> How DO you use the CSV to SQL action to create an SQLite database, and how
>> do you "round trip" it and pull data back out of the resulting database.
>> That is, what does the result really look like?
>>
>> The CSV to SQL action is an Apple action.
>>
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Automator-users mailing list (email@hidden)
>> Help/Unsubscribe/Update your Subscription:
> I don't think this will do what you think it does. I have never used it. This
> is the description
> given by the action in Automator:
>
> Supply SQL commands to be placed before the input, to be used in place of each
> line of input, and to be placed after the input. Also indicate whether the
> first line of input is a header containing column names. To substitute the
> value of a field in the current line of input, use the format %{field}@ where
> field is the number of the field starting from 1. In the SQL to be placed
> before and after the input, the current line is the first line of input.
>
> This sounds to me like it generates a SQL statement from a combination of the
> SQL wrapper you provide and the CSV data contained in your CSV data file. The
> result it is supposed to provide is listed as: (Text) One sequence of SQL
> commands per input. It does not appear that this will create a SQLite
> database, nor will it query one. (As an aside, SQL does not equal SQLite.)
>
> There are plenty of sample tutorials around regarding SQLite commands and you
> can use Applescript to generate a SQLite database if that is what you are
> looking for. This automator action isn't going to do it for you though.
>
> vince
I am fully aware of what SQL is and what SQLite is.
You may now download a simple but functional automator example at the
location noted below. It takes a CSV formatted file (example provided),
writes the SQL using CSV to SQL, writes to database file which you
designate, and extracts the results.
http://www.concise-design.com/downloads/automatorcsv.zip
Bruce Robertson
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Automator-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden