Package: pipelinewise-tap-s3-csv
pipelinewise-tap-s3-csvThis is aSingertap that reads data from files located inside a given S3 bucket and produces JSON-formatted data following theSinger spec.This is aPipelineWisecompatible tap connector.How to use itThe recommended method of running this tap is to use it fromPipelineWise. When running it from PipelineWise you don't need to configure this tap with JSON files and most of things are automated. Please check the related documentation atTap S3 CSVIf you want to run thisSinger Tapindependently please read further.Install and RunFirst, make sure Python 3 is installed on your system or follow these
installation instructions forMacorUbuntu.It's recommended to use a virtualenv:python3-mvenvvenvpipinstallpipelinewise-tap-s3-csvorpython3-mvenvvenv.venv/bin/activatepipinstall--upgradepippipinstall.ConfigurationHere is an example of basic config, that's using the defualt Profile based authentication:```json
{
    "start_date": "2000-01-01T00:00:00Z",
    "bucket": "tradesignals-crawler",
    "tables": [{
        "search_prefix": "feeds",
        "search_pattern": ".csv",
        "table_name": "my_table",
        "key_properties": ["id"],
        "delimiter": ","
    }]
}
```Profile based authenticationProfile based authentication used by default using thedefaultprofile. To use another profile setaws_profileparameter inconfig.jsonor set theAWS_PROFILEenvironment variable.Non-Profile based authenticationFor non-profile based authentication setaws_access_key_id,aws_secret_access_keyand optionally theaws_session_tokenparameter in theconfig.json. Alternatively you can define them out ofconfig.jsonby settingAWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEYandAWS_SESSION_TOKENenvironment variables.A bit of a run down on each of the properties:aws_profile: AWS Profile name for Profile based authentication. If not provided,AWS_PROFILEenvironment variable will be used.aws_access_key_id: AWS access key ID for Non-Profile based authentication. If not provided,AWS_ACCESS_KEY_IDenvironment variable will be used.aws_secret_access_key: AWS secret access key for Non-Profile based authentication. If not provided,AWS_SECRET_ACCESS_KEYenvironment variable will be used.aws_session_token: AWS session token for Non-Profile based authentication. If not provided,AWS_SESSION_TOKENenvironment variable will be used.aws_endpoint_url: (Optional): The complete URL to use for the constructed client. Normally, botocore will automatically construct the appropriate URL to use when communicating with a service. You can specify a complete URL (including the "http/https" scheme) to override this behavior. For examplehttps://nyc3.digitaloceanspaces.comstart_date: This is the datetime that the tap will use to look for newly updated or created files, based on the modified timestamp of the file.bucket: The name of the bucket to search for files under.tables: JSON object that the tap will use to search for files, and emit records as "tables" from those files.Thetablefield consists of one or more objects, that describe how to find files and emit records. A more detailed (and unescaped) example below:[
    {
        "search_prefix": "exports"
        "search_pattern": "my_table\\/.*\\.csv",
        "table_name": "my_table",
        "key_properties": ["id"],
        "date_overrides": ["created_at"],
        "delimiter": ","
    },
    ...
]search_prefix: This is a prefix to apply after the bucket, but before the file search pattern, to allow you to find files in "directories" below the bucket.search_pattern: This is an escaped regular expression that the tap will use to find files in the bucket + prefix. It's a bit strange, since this is an escaped string inside of an escaped string, any backslashes in the RegEx will need to be double-escaped.table_name: This value is a string of your choosing, and will be used to name the stream that records are emitted under for files matching content.key_properties: These are the "primary keys" of the CSV files, to be used by the target for deduplication and primary key definitions downstream in the destination.date_overrides: Specifies field names in the files that are supposed to be parsed as a datetime. The tap doesn't attempt to automatically determine if a field is a datetime, so this will make it explicit in the discovered schema.delimiter: This allows you to specify a custom delimiter, such as\tor|, if that applies to your files.A sample configuration is available insideconfig.sample.jsonTo run tests:Install python test dependencies in a virtual env and run nose unit and integration testsmake venvTo run unit tests:make unit_testsTo run integration tests:Integration tests require a valid S3 bucket and credentials should be passed as environment variables, this project uses Minio server.Fist, start a Minio server docker container:mkdir-p./minio/data/awesome_bucketUID=$(id-u)GID=$(id-g)docker-composeup-dRun integration tests:makeintegration_testsTo run pylint:Install python dependencies and run python lintermake venv pylint