Skip to main content
Question

Read specific table from Microsoft Database


chavdar
Contributor
Forum|alt.badge.img+2

I would like to open and read a .accdb file which contains multiple named tables. Instead of reading all tables I just want to select the ones which names match the ID criteria.

The example below works fine by using a Microsoft Access reader which compiles all tables into one single merged feature type. After that I compare the source CSV file name against one of the listed attributes and pass forward only the matched lines. 
 

That method worked well and served its purpose, but the downside is that it is way too slow since it is reading the whole accdb and this file is constantly growing because we keep on adding tables over time.

I have tried to use the Feature Reader with an initiator which provides the route ID as a key to search an open table if name contains the ID but with no luck. I have tried to add a SQL WHERE statement but still no luck.
 

Once again, my simple aim is to pull out tables from a accdb which names meet the ID criteria.

8 replies

nielsgerrits
VIP
Forum|alt.badge.img+54

One way to do this is to use a FeatureReader and use an attribute with the table name(s) for the Feature Types to Read field.

  • Creator to initiate.
  • AttributeCreator to create an attribute “TableName” with the name of the table you want to read.
  • FeatureReader, Format = Microsoft Access, Feature Types to Read = TableName.

chavdar
Contributor
Forum|alt.badge.img+2
  • Author
  • Contributor
  • April 23, 2025

Thanks for your reply.

In fact I already have the attribute fed in the Feature reader as a single attribute as an initiator ID

- for an example “H1_OCPJ11” and this string is contained in multiple table names 
TRN192_H1_OCPJ11_1 PASS_DATA_AVG
TRN191_H1_OCPJ11_1 PASS_DATA_AVG
TRN190_H1_OCPJ11_1 PASS_DATA_AVG

… and those are the only tables (out of thousands in total) which I want to select an pass their contents forward.


nielsgerrits
VIP
Forum|alt.badge.img+54

I don’t think you can use it as a wildcard. What I would do is use a first FeatureReader, reading only the Schema features, this will return all table names. Then use a Tester to find the ones you need and feed that in a second FeatureReader reading the data.


chavdar
Contributor
Forum|alt.badge.img+2
  • Author
  • Contributor
  • April 23, 2025

Thanks for the idea, but how I can read only the Schema features without reading the whole accdb file?


nielsgerrits
VIP
Forum|alt.badge.img+54

 


chavdar
Contributor
Forum|alt.badge.img+2
  • Author
  • Contributor
  • April 23, 2025

Perfect, I found that option. 
It is now spilling the Schema Features which I convert into a list of attributes, but still the initial read of the db takes quite some time:

May I do something to speed up that process? I just aim for the list of table names :(
Perhaps a SQL code before read could help 
 


 


nielsgerrits
VIP
Forum|alt.badge.img+54

I see the file is on a network share. Copy the file to a local folder and see if the problem goes away. If this is the case, the file location is causing the time to load.


takashi
Influencer
  • April 23, 2025

Hi ​@chavdar .

I have tried to use the Feature Reader with an initiator which provides the route ID as a key to search an open table if name contains the ID but with no luck. I have tried to add a SQL WHERE statement but still no luck.

In my quick test, it seems that the WHERE Clause setting in FeatureReader (Format: Microsoft Access) doesn't work if Feature Types to Read parameter was blank (<All Feature Types> is shown).
Select all the feature types (tables) in the parameter and see what happens.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings