Gossamer Forum
Home : Products : Gossamer Links : Discussions :

import links (ok) import cats (error)

Quote Reply
import links (ok) import cats (error)
just imported several batches of links, after various help/advice from forum

importing links went ok - imported 1950 links

so I thought I would try importing "cats"

used same "process -steps as for my importing links" - produced error messages

Q: whats the best / standard way of importing categories?

after exporting the "category" (only 10 categories), table to listodcats.txt, edited "added 1 new cat", imported listofcats.txt

error message was something like "too many errors.....import abandond

I checked the data, all looked ok

I copy / pasted the new cat data into the text area - still produced an error message, but checking the cat data "export to screen" I can see the new cat has been added

help or advice please Unsure
Colin Thompson
Quote Reply
Re: [colintho] import links (ok) import cats (error) In reply to
Hi!

My God! You still have problems!

The best way to import categories is to have them ready before links are imported.

The reason is that the import function will first have categories loaded in the memory, then try to figureout - for each category which are the links available - and then start inserting them.

So the insertion of links is related to categories and not just dumping the links somehow into the database. If there are no categories in the import.txt then it will not take them togather with inserting into the database, I beleive, or may insert as orphan links.

The "error too many" is an error I have seen more than a thousand times. Only after a while, one gets a good view of what they are, since they do not say very stronly what exactly is the error, while showing really truely where exactly they are. So you need to be very careful in understanding them and moreover, pasting them here in case of asking for a support.

Most likely, in your case, I smell it that the import routine had found the same links inside the table and gave too many errors, as the delete prior to import function was "not checked"! Saying out of experience without knowing more details.

For instance, one type would be, the field number match. Count the number of fields in the table and the data being imported. Anathor would be also field property type.

The best way to import is to use the in build routine of Links SQL module. It has a function like - check extra integrety, delete first the old data, etc. The import modules have extra-ordinary tight design ínbuilt within them. You just cannot bypass through the errors.
Quote Reply
Re: [dearnet] import links (ok) import cats (error) In reply to
thanks for the reply.

just tried this:

manually created new sub-category "manchester", checked site after "build" all looked ok

went into admin did an export data, "listcats.txt"

imported into excel - could see row for sub-category just made

copy / pasted "manchester" row to add new cat "merseyside"

edited the "copy-of-manchester" row to format the data for "merseyside"

changed the ID to last ID +1 / changed the timestamp / name / full name / keywords

saved as "listcats2.txt" file, edited this txt file so that only 2 rows remained the column names + "merseyside" data


Timestmp|Newest_Link|Has_Changed_Links|Has_New_Links|Number_of_Links|Category_Template|Footer|Header|Meta_Keywords|Meta_Description|Description|Full_Name|FatherID|Name|ID

20030120110945|0000-00-00|No|No|0||||"Hotel,Merseyside,Birkenhead,Liverpool,Prenton,Prescot"|Hotels in Merseyside|Hotels in Merseyside|Hotel Directory/Merseyside|9|Merseyside|34


in LinksSql admin, categories, did import data from file "linkscats2.txt"

got this error message:

Rows imported: 1
Errors with the following rows:
  • 2: Failed validation. Error:
      Invalid category name: FatherID


looked at site after "build" the imported sub-cat "merseyside" appears to be ok

What am I doing wrong to cause the error message?


Did I need to have the column names in the imported txt file?

Colin Thompson
Quote Reply
Re: [colintho] import links (ok) import cats (error) In reply to
Hi!
  1. Do have column names in the first line.
  2. The sequence of the field should be exactly identical to that in the table, or atleast in the defs. Look into the defs dir and make sure that the sequence is also the same. You could resync from the properties of the table or from the setup.


The above two are only tips. You now have following problem:

FatherID|Name|ID

9|Merseyside|34

Now you are simply trying to write in this line that the link belongs to the category "Merseyside". As I told you earlier, the import routines first gets all the category and then drag all the links belonging to that category and insert them into the database.

So the link belongs to the category Merseyside but there is no category in the database. So if you create a new category Merseyside in the table Category, then it will or MUST get in.



Or most likely there is also a function out there (I do not remember!) "Create missing cats" is it? If this is clicked, then may be it should create one if the category does not exists.

Understand? Feel free to ask.

Last edited by:

dearnet: Jan 20, 2003, 3:43 AM
Quote Reply
Re: [dearnet] import links (ok) import cats (error) In reply to
OK yes - the first line includes column names

what I can see is a difference between the cat table definition is the column postion / order is different

postion 1,2,3 reads "ID|Name|FatherID....Has_Changed_Links|Newest_Link|Timestmp"



from cat table export to screen or txt files the order is reversed like this (as i copied the exported txt file, my edited file that I imported with a new cat "merseyside" was also in this reverse order)

Timestmp|Newest_Link|Has_Changed_Links|Has_New_Links|Number_of_Links...........|FatherID|Name|ID

How can I fix this?

so the exported file screen or txt is in the same order?
Colin Thompson
Quote Reply
Re: [colintho] import links (ok) import cats (error) In reply to
Hi!

Ack, I am truely NOT surprised with the exporter giving an inverted or mirrod field values! For your information, Links table is the only table that exports a normal sequence by adding the table name to it and each and every other table is exported in a mirrored sequence without exception. This is not a discovery but a known fact. I have`nt understood but it could be that the import of the entire backup requires it or the programming has been done without this factor in mind.

There is no logical reason why you should use for a normal export of a Category table, the in-built-routine of Links SQL.

In your case, the Field sequence has changed and therefore it cannot read the FatherID! It`s like telephone plug. If you reverse, it would`nt fit in, understand! Thats what the export of "other than Links table" is done.

Firstly is the Category Merseyside inside the Category table? This is the first important thing to look at.

Forget the export sequence of the field on the screen. Make sure that you follow the following procedure.
  1. Look with the help of MySQLMan or PhpMyadmin the field sequence. They will list the true field sequence. This is just to inform yourself.
  2. Compare them with the Category.def sequence. This should be the way how they are in the database and also the way how they have been designed. Default configuration.
  3. Thereafter make sure that the same sequence is followed in the first line of Column names in the file you try to import.
  4. Make sure that the Category Merseysideis in there in the database, i.e. create that FatherID.
  5. Have data in the second line with the same sequence of the fields in the import file. MAKE SURE that the FatherID location in the sequence matches to the first line.
  6. THEN IT MUST WORK. That line being imported must match with what can be fitted into that table. Left = right! Understand?
You have everything most likely correct, since it is a default installation. It can only be in the sequence of the wrong location of the FatherID as it cannot find it! So have the first line and the following data the same as what MySQLMan orr PhpMyAdmin shows you.

There are times when even the field/Columns listing is shown totally wrong in the Admin when you use the Database function>properties. This is not for an accurate view of the tables but to view the configuration i.e. Defs files with which the scripts may try to interface. The other two utilities will interface directly with the database in real time and tell you whats out there.

Last edited by:

dearnet: Jan 20, 2003, 8:32 AM
Quote Reply
Re: [dearnet] import links (ok) import cats (error) In reply to
thanks again for the help / info / advice Smile

where can I see the "Category.def"


I did'nt realise this "mirror" of the column names was normal


the imported category data for "merseyside" is in the table and works OK, website works OK

So, if I look at the cat table column order and format my "cat" data that I wish to import, it should function ok through the "cat table import data tool"?

Thanks again.
Colin Thompson
Quote Reply
Re: [colintho] import links (ok) import cats (error) In reply to
Hi!

Oops, I was not so specific.

You will find defs, all of them under your admin directory called "defs", the so-called Definitions files of each respective table known or named as Category.def. Path to your installation/admin/defs. It is not necessary to check it out, but the idea was to give you an exposure of what things are and where to look in to have a feeling of the steps in which the import goes through.

You can make Table in Database = the respective Def file by clicking in your admin > Database > Properties > down - Resync Database (Resysncronise the def files based on the table field sequence). By this the def files will be updated. This is necessary only if you have added a field in the table (which you can very easily), which I do not think you have.

Quote:
So, if I look at the cat table column order and format my "cat" data that I wish to import, it should function ok through the "cat table import data tool"?


Yes.

If it does not, use MySQLMan tool, which may also do the same thing. You can use the SQL Monitor or even import. If you can manage it with Links, the best instead of getting into other problems in handling the other tools.
Quote:
the imported category data for "merseyside" is in the table and works OK


After you clearified that you are stuck in the Category import, I realised that you are not importing Links but only categories. Your error was then in the Category import table and NOT due to a missing category. My mistake. Sorry.

But what is your problem now? If the format is the same, it will import all. Or did I understand wrong again?
Quote Reply
Re: [dearnet] import links (ok) import cats (error) In reply to
hopefully no problem

I shall try and import cat table data using the correct sequence / order for the column names.

Thanks once again.
Colin Thompson