abc icon indicating copy to clipboard operation
abc copied to clipboard

src_filter not working

Open hobbesuk opened this issue 4 years ago • 2 comments

abc --version
Version:    0.6.7
Variant:    !oss
Go version: go1.11.1
OS:         linux
Arch:       amd64

I'm trying to import only one collection from a mongodb database which has three collections, but I think because two of my collections are similarly named the regex picks up both, this then fails in elastic because it tries to create two mapping types, e.g. I see this on the import:

INFO[0000] Connection to mongo_server:27017 established. 
INFO[0000] collection count                              db="data" num_collections=3
INFO[0000] adding for iteration...                       collection="market_raw_data" db="data"
INFO[0000] adding for iteration...                       collection="raw_data" db="data"
INFO[0000] skipping iteration...                         collection=updateQueue db="data"
INFO[0000] done iterating collections                    db="data"

My transform file looks like:

t.Source("source", source, "/raw_data/")
       .Mapping({
		"raw_data": {
			"properties":{
				"mongo_id" : {
					"properties" : {
				            "date": {
            					"type":"date",
	            			        "format": "yyyyMMdd"
		                        	}
					}
				}
			}
		}
	})
	// more transforms
	.Save("sink", sink, "/.*/")

How can I exclude it from picking up this collection:

INFO[0000] adding for iteration... collection="market_raw_data" db="data"

hobbesuk avatar Nov 22 '19 11:11 hobbesuk

same behavior here for:

$ abc --version                                                           
Version:    1.0.0-beta.2
Variant:    !oss
Go version: go1.11.13
OS:         linux
abc import --src_filter="table3" ...

neither

abc import --src_filter="public.table3" ...

adrianovieira avatar May 11 '21 15:05 adrianovieira

src_filter option will not work when you are using a transform file. In that case, put the filter in the namespace selector in .Source method. for example in postgresql: t.Source("source", source, "/.*test_schema.test_table")

zhuyuhuanba avatar Jan 03 '24 07:01 zhuyuhuanba