mage-integrations 0.2.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mage_integrations/__init__.py +0 -0
- mage_integrations/connections/__init__.py +0 -0
- mage_integrations/connections/airtable/__init__.py +31 -0
- mage_integrations/connections/base.py +19 -0
- mage_integrations/connections/bigquery/__init__.py +49 -0
- mage_integrations/connections/constants.py +3 -0
- mage_integrations/connections/couchbase/__init__.py +43 -0
- mage_integrations/connections/doris/__init__.py +89 -0
- mage_integrations/connections/dremio/__init__.py +104 -0
- mage_integrations/connections/google_analytics/__init__.py +104 -0
- mage_integrations/connections/google_analytics/constants.py +266 -0
- mage_integrations/connections/google_analytics/utils.py +14 -0
- mage_integrations/connections/google_cloud_storage/__init__.py +33 -0
- mage_integrations/connections/google_search_console/__init__.py +58 -0
- mage_integrations/connections/google_sheets/__init__.py +96 -0
- mage_integrations/connections/mssql/__init__.py +60 -0
- mage_integrations/connections/mysql/__init__.py +93 -0
- mage_integrations/connections/oracledb/__init__.py +33 -0
- mage_integrations/connections/postgresql/__init__.py +39 -0
- mage_integrations/connections/redshift/__init__.py +45 -0
- mage_integrations/connections/snowflake/__init__.py +47 -0
- mage_integrations/connections/sql/__init__.py +0 -0
- mage_integrations/connections/sql/base.py +124 -0
- mage_integrations/connections/teradata/__init__.py +33 -0
- mage_integrations/connections/trino/__init__.py +40 -0
- mage_integrations/connections/trino/connection_wrapper.py +28 -0
- mage_integrations/connections/utils/__init__.py +0 -0
- mage_integrations/connections/utils/google.py +14 -0
- mage_integrations/connections/utils/sql.py +2 -0
- mage_integrations/destinations/__init__.py +0 -0
- mage_integrations/destinations/airtable/Readme.md +27 -0
- mage_integrations/destinations/airtable/__init__.py +92 -0
- mage_integrations/destinations/airtable/templates/config.json +4 -0
- mage_integrations/destinations/amazon_s3/README.md +24 -0
- mage_integrations/destinations/amazon_s3/__init__.py +172 -0
- mage_integrations/destinations/amazon_s3/templates/config.json +10 -0
- mage_integrations/destinations/amplitude/README.md +58 -0
- mage_integrations/destinations/amplitude/__init__.py +91 -0
- mage_integrations/destinations/amplitude/templates/config.json +5 -0
- mage_integrations/destinations/base.py +810 -0
- mage_integrations/destinations/bigquery/README.md +54 -0
- mage_integrations/destinations/bigquery/__init__.py +834 -0
- mage_integrations/destinations/bigquery/constants.py +8 -0
- mage_integrations/destinations/bigquery/templates/config.json +8 -0
- mage_integrations/destinations/bigquery/utils.py +304 -0
- mage_integrations/destinations/clickhouse/LICENSE +201 -0
- mage_integrations/destinations/clickhouse/README.md +14 -0
- mage_integrations/destinations/clickhouse/__init__.py +32 -0
- mage_integrations/destinations/clickhouse/target_clickhouse/__init__.py +1 -0
- mage_integrations/destinations/clickhouse/target_clickhouse/sinks.py +234 -0
- mage_integrations/destinations/clickhouse/target_clickhouse/target.py +137 -0
- mage_integrations/destinations/clickhouse/templates/config.json +4 -0
- mage_integrations/destinations/constants.py +50 -0
- mage_integrations/destinations/delta_lake/README.md +0 -0
- mage_integrations/destinations/delta_lake/__init__.py +0 -0
- mage_integrations/destinations/delta_lake/base.py +227 -0
- mage_integrations/destinations/delta_lake/constants.py +2 -0
- mage_integrations/destinations/delta_lake_azure/README.md +18 -0
- mage_integrations/destinations/delta_lake_azure/__init__.py +45 -0
- mage_integrations/destinations/delta_lake_azure/templates/config.json +6 -0
- mage_integrations/destinations/delta_lake_s3/README.md +21 -0
- mage_integrations/destinations/delta_lake_s3/__init__.py +130 -0
- mage_integrations/destinations/delta_lake_s3/templates/config.json +9 -0
- mage_integrations/destinations/doris/README.md +32 -0
- mage_integrations/destinations/doris/__init__.py +209 -0
- mage_integrations/destinations/doris/constants.py +755 -0
- mage_integrations/destinations/doris/templates/config.json +9 -0
- mage_integrations/destinations/doris/utils.py +118 -0
- mage_integrations/destinations/elasticsearch/README.md +57 -0
- mage_integrations/destinations/elasticsearch/__init__.py +37 -0
- mage_integrations/destinations/elasticsearch/target_elasticsearch/__init__.py +0 -0
- mage_integrations/destinations/elasticsearch/target_elasticsearch/common.py +32 -0
- mage_integrations/destinations/elasticsearch/target_elasticsearch/sinks.py +262 -0
- mage_integrations/destinations/elasticsearch/target_elasticsearch/target.py +267 -0
- mage_integrations/destinations/elasticsearch/templates/config.json +8 -0
- mage_integrations/destinations/google_cloud_storage/README.md +19 -0
- mage_integrations/destinations/google_cloud_storage/__init__.py +109 -0
- mage_integrations/destinations/google_cloud_storage/templates/config.json +8 -0
- mage_integrations/destinations/kafka/README.md +18 -0
- mage_integrations/destinations/kafka/__init__.py +91 -0
- mage_integrations/destinations/kafka/templates/config.json +5 -0
- mage_integrations/destinations/mongodb/README.md +11 -0
- mage_integrations/destinations/mongodb/__init__.py +28 -0
- mage_integrations/destinations/mongodb/target_mongodb/__init__.py +0 -0
- mage_integrations/destinations/mongodb/target_mongodb/sinks.py +135 -0
- mage_integrations/destinations/mongodb/target_mongodb/target.py +169 -0
- mage_integrations/destinations/mongodb/templates/config.json +5 -0
- mage_integrations/destinations/mssql/README.md +31 -0
- mage_integrations/destinations/mssql/__init__.py +214 -0
- mage_integrations/destinations/mssql/templates/config.json +10 -0
- mage_integrations/destinations/mssql/utils.py +101 -0
- mage_integrations/destinations/mysql/README.md +36 -0
- mage_integrations/destinations/mysql/__init__.py +215 -0
- mage_integrations/destinations/mysql/constants.py +755 -0
- mage_integrations/destinations/mysql/templates/config.json +9 -0
- mage_integrations/destinations/mysql/utils.py +154 -0
- mage_integrations/destinations/opensearch/README.md +22 -0
- mage_integrations/destinations/opensearch/__init__.py +35 -0
- mage_integrations/destinations/opensearch/target_opensearch/__init__.py +0 -0
- mage_integrations/destinations/opensearch/target_opensearch/common.py +30 -0
- mage_integrations/destinations/opensearch/target_opensearch/sinks.py +221 -0
- mage_integrations/destinations/opensearch/target_opensearch/target.py +241 -0
- mage_integrations/destinations/opensearch/templates/config.json +5 -0
- mage_integrations/destinations/oracledb/README.md +22 -0
- mage_integrations/destinations/oracledb/__init__.py +241 -0
- mage_integrations/destinations/oracledb/templates/config.json +10 -0
- mage_integrations/destinations/oracledb/utils.py +114 -0
- mage_integrations/destinations/postgresql/README.md +30 -0
- mage_integrations/destinations/postgresql/__init__.py +264 -0
- mage_integrations/destinations/postgresql/templates/config.json +9 -0
- mage_integrations/destinations/postgresql/utils.py +77 -0
- mage_integrations/destinations/redshift/README.md +45 -0
- mage_integrations/destinations/redshift/__init__.py +306 -0
- mage_integrations/destinations/redshift/constants.py +155 -0
- mage_integrations/destinations/redshift/templates/config.json +11 -0
- mage_integrations/destinations/redshift/utils.py +28 -0
- mage_integrations/destinations/salesforce/README.md +38 -0
- mage_integrations/destinations/salesforce/__init__.py +37 -0
- mage_integrations/destinations/salesforce/target_salesforce/__init__.py +0 -0
- mage_integrations/destinations/salesforce/target_salesforce/session_credentials.py +96 -0
- mage_integrations/destinations/salesforce/target_salesforce/sinks.py +161 -0
- mage_integrations/destinations/salesforce/target_salesforce/target.py +182 -0
- mage_integrations/destinations/salesforce/target_salesforce/utils/__init__.py +0 -0
- mage_integrations/destinations/salesforce/target_salesforce/utils/exceptions.py +10 -0
- mage_integrations/destinations/salesforce/target_salesforce/utils/transformation.py +25 -0
- mage_integrations/destinations/salesforce/target_salesforce/utils/validation.py +54 -0
- mage_integrations/destinations/salesforce/templates/config.json +8 -0
- mage_integrations/destinations/sink.py +594 -0
- mage_integrations/destinations/snowflake/README.md +39 -0
- mage_integrations/destinations/snowflake/__init__.py +582 -0
- mage_integrations/destinations/snowflake/constants.py +1 -0
- mage_integrations/destinations/snowflake/templates/config.json +14 -0
- mage_integrations/destinations/snowflake/utils.py +92 -0
- mage_integrations/destinations/sql/__init__.py +0 -0
- mage_integrations/destinations/sql/base.py +435 -0
- mage_integrations/destinations/sql/constants.py +843 -0
- mage_integrations/destinations/sql/utils.py +363 -0
- mage_integrations/destinations/sqlsink.py +414 -0
- mage_integrations/destinations/target.py +561 -0
- mage_integrations/destinations/teradata/README.md +18 -0
- mage_integrations/destinations/teradata/__init__.py +357 -0
- mage_integrations/destinations/teradata/templates/config.json +7 -0
- mage_integrations/destinations/teradata/utils.py +103 -0
- mage_integrations/destinations/trino/README.md +84 -0
- mage_integrations/destinations/trino/__init__.py +27 -0
- mage_integrations/destinations/trino/connectors/__init__.py +0 -0
- mage_integrations/destinations/trino/connectors/base.py +325 -0
- mage_integrations/destinations/trino/connectors/deltalake.py +53 -0
- mage_integrations/destinations/trino/connectors/iceberg.py +19 -0
- mage_integrations/destinations/trino/templates/config.json +14 -0
- mage_integrations/destinations/trino/utils.py +33 -0
- mage_integrations/destinations/utils.py +50 -0
- mage_integrations/sources/README.md +3 -0
- mage_integrations/sources/__init__.py +0 -0
- mage_integrations/sources/airtable/README.md +27 -0
- mage_integrations/sources/airtable/__init__.py +180 -0
- mage_integrations/sources/airtable/templates/config.json +5 -0
- mage_integrations/sources/amazon_s3/README.md +25 -0
- mage_integrations/sources/amazon_s3/__init__.py +298 -0
- mage_integrations/sources/amazon_s3/templates/config.json +11 -0
- mage_integrations/sources/amplitude/README.md +67 -0
- mage_integrations/sources/amplitude/__init__.py +356 -0
- mage_integrations/sources/amplitude/constants.py +58 -0
- mage_integrations/sources/amplitude/schemas/active_users.json +28 -0
- mage_integrations/sources/amplitude/schemas/annotations.json +54 -0
- mage_integrations/sources/amplitude/schemas/average_session_length.json +28 -0
- mage_integrations/sources/amplitude/schemas/cohort_members.json +34 -0
- mage_integrations/sources/amplitude/schemas/cohorts.json +144 -0
- mage_integrations/sources/amplitude/schemas/event_properties.json +72 -0
- mage_integrations/sources/amplitude/schemas/event_types.json +77 -0
- mage_integrations/sources/amplitude/schemas/events.json +349 -0
- mage_integrations/sources/amplitude/schemas/new_users.json +28 -0
- mage_integrations/sources/amplitude/schemas/sessions_per_user.json +28 -0
- mage_integrations/sources/amplitude/schemas/user_properties.json +66 -0
- mage_integrations/sources/amplitude/templates/config.json +7 -0
- mage_integrations/sources/amplitude/templates/query.json +4 -0
- mage_integrations/sources/api/README.md +211 -0
- mage_integrations/sources/api/__init__.py +279 -0
- mage_integrations/sources/api/templates/config.json +9 -0
- mage_integrations/sources/azure_blob_storage/README.md +21 -0
- mage_integrations/sources/azure_blob_storage/__init__.py +160 -0
- mage_integrations/sources/azure_blob_storage/templates/config.json +5 -0
- mage_integrations/sources/base.py +781 -0
- mage_integrations/sources/bigquery/README.md +49 -0
- mage_integrations/sources/bigquery/__init__.py +56 -0
- mage_integrations/sources/bigquery/templates/config.json +4 -0
- mage_integrations/sources/catalog.py +125 -0
- mage_integrations/sources/chargebee/README.md +21 -0
- mage_integrations/sources/chargebee/__init__.py +83 -0
- mage_integrations/sources/chargebee/client.py +194 -0
- mage_integrations/sources/chargebee/schemas/common/cards.json +57 -0
- mage_integrations/sources/chargebee/schemas/common/comments.json +30 -0
- mage_integrations/sources/chargebee/schemas/common/credit_notes.json +404 -0
- mage_integrations/sources/chargebee/schemas/common/customers.json +428 -0
- mage_integrations/sources/chargebee/schemas/common/gifts.json +85 -0
- mage_integrations/sources/chargebee/schemas/common/invoices.json +680 -0
- mage_integrations/sources/chargebee/schemas/common/orders.json +431 -0
- mage_integrations/sources/chargebee/schemas/common/payment_sources.json +180 -0
- mage_integrations/sources/chargebee/schemas/common/promotional_credits.json +46 -0
- mage_integrations/sources/chargebee/schemas/common/quotes.json +380 -0
- mage_integrations/sources/chargebee/schemas/common/transactions.json +241 -0
- mage_integrations/sources/chargebee/schemas/common/virtual_bank_accounts.json +56 -0
- mage_integrations/sources/chargebee/schemas/item_model/coupons.json +251 -0
- mage_integrations/sources/chargebee/schemas/item_model/events.json +653 -0
- mage_integrations/sources/chargebee/schemas/item_model/item_families.json +63 -0
- mage_integrations/sources/chargebee/schemas/item_model/item_prices.json +342 -0
- mage_integrations/sources/chargebee/schemas/item_model/items.json +187 -0
- mage_integrations/sources/chargebee/schemas/item_model/subscriptions.json +873 -0
- mage_integrations/sources/chargebee/schemas/plan_model/addons.json +163 -0
- mage_integrations/sources/chargebee/schemas/plan_model/coupons.json +103 -0
- mage_integrations/sources/chargebee/schemas/plan_model/events.json +647 -0
- mage_integrations/sources/chargebee/schemas/plan_model/plans.json +250 -0
- mage_integrations/sources/chargebee/schemas/plan_model/subscriptions.json +465 -0
- mage_integrations/sources/chargebee/state.py +44 -0
- mage_integrations/sources/chargebee/streams/__init__.py +69 -0
- mage_integrations/sources/chargebee/streams/addons.py +19 -0
- mage_integrations/sources/chargebee/streams/base.py +244 -0
- mage_integrations/sources/chargebee/streams/comments.py +19 -0
- mage_integrations/sources/chargebee/streams/coupons.py +24 -0
- mage_integrations/sources/chargebee/streams/credit_notes.py +19 -0
- mage_integrations/sources/chargebee/streams/customers.py +19 -0
- mage_integrations/sources/chargebee/streams/events.py +24 -0
- mage_integrations/sources/chargebee/streams/gifts.py +19 -0
- mage_integrations/sources/chargebee/streams/invoices.py +19 -0
- mage_integrations/sources/chargebee/streams/item_families.py +19 -0
- mage_integrations/sources/chargebee/streams/item_prices.py +19 -0
- mage_integrations/sources/chargebee/streams/items.py +19 -0
- mage_integrations/sources/chargebee/streams/orders.py +19 -0
- mage_integrations/sources/chargebee/streams/payment_sources.py +19 -0
- mage_integrations/sources/chargebee/streams/plans.py +19 -0
- mage_integrations/sources/chargebee/streams/promotional_credits.py +19 -0
- mage_integrations/sources/chargebee/streams/quotes.py +19 -0
- mage_integrations/sources/chargebee/streams/subscriptions.py +24 -0
- mage_integrations/sources/chargebee/streams/transactions.py +19 -0
- mage_integrations/sources/chargebee/streams/util.py +6 -0
- mage_integrations/sources/chargebee/streams/virtual_bank_accounts.py +19 -0
- mage_integrations/sources/chargebee/templates/config.json +7 -0
- mage_integrations/sources/commercetools/README.md +28 -0
- mage_integrations/sources/commercetools/__init__.py +40 -0
- mage_integrations/sources/commercetools/client.py +54 -0
- mage_integrations/sources/commercetools/schemas/customers.json +108 -0
- mage_integrations/sources/commercetools/schemas/discount_codes.json +77 -0
- mage_integrations/sources/commercetools/schemas/inventory.json +50 -0
- mage_integrations/sources/commercetools/schemas/orders.json +542 -0
- mage_integrations/sources/commercetools/schemas/payments.json +113 -0
- mage_integrations/sources/commercetools/schemas/products.json +82 -0
- mage_integrations/sources/commercetools/schemas/shared/address.json +83 -0
- mage_integrations/sources/commercetools/schemas/shared/created_by.json +17 -0
- mage_integrations/sources/commercetools/schemas/shared/custom.json +17 -0
- mage_integrations/sources/commercetools/schemas/shared/dimension.json +11 -0
- mage_integrations/sources/commercetools/schemas/shared/discounted_price_per_quantity.json +30 -0
- mage_integrations/sources/commercetools/schemas/shared/field_type.json +8 -0
- mage_integrations/sources/commercetools/schemas/shared/key_reference.json +11 -0
- mage_integrations/sources/commercetools/schemas/shared/last_modified_by.json +17 -0
- mage_integrations/sources/commercetools/schemas/shared/localized_string.json +8 -0
- mage_integrations/sources/commercetools/schemas/shared/money.json +17 -0
- mage_integrations/sources/commercetools/schemas/shared/price.json +56 -0
- mage_integrations/sources/commercetools/schemas/shared/price_scoped.json +45 -0
- mage_integrations/sources/commercetools/schemas/shared/product_data.json +52 -0
- mage_integrations/sources/commercetools/schemas/shared/product_variant.json +132 -0
- mage_integrations/sources/commercetools/schemas/shared/reference.json +22 -0
- mage_integrations/sources/commercetools/schemas/shared/shipping_details.json +22 -0
- mage_integrations/sources/commercetools/schemas/shared/state.json +11 -0
- mage_integrations/sources/commercetools/schemas/shared/taxed_item_price.json +11 -0
- mage_integrations/sources/commercetools/schemas/shared/taxed_price.json +28 -0
- mage_integrations/sources/commercetools/schemas/shared/taxrate.json +37 -0
- mage_integrations/sources/commercetools/schemas.py +25 -0
- mage_integrations/sources/commercetools/streams/__init__.py +0 -0
- mage_integrations/sources/commercetools/streams/base.py +30 -0
- mage_integrations/sources/commercetools/streams/customers.py +7 -0
- mage_integrations/sources/commercetools/streams/discount_codes.py +7 -0
- mage_integrations/sources/commercetools/streams/inventory.py +7 -0
- mage_integrations/sources/commercetools/streams/orders.py +7 -0
- mage_integrations/sources/commercetools/streams/payments.py +7 -0
- mage_integrations/sources/commercetools/streams/products.py +7 -0
- mage_integrations/sources/commercetools/templates/config.json +7 -0
- mage_integrations/sources/constants.py +46 -0
- mage_integrations/sources/couchbase/README.md +25 -0
- mage_integrations/sources/couchbase/__init__.py +140 -0
- mage_integrations/sources/couchbase/templates/config.json +7 -0
- mage_integrations/sources/couchbase/utils.py +58 -0
- mage_integrations/sources/datadog/README.md +25 -0
- mage_integrations/sources/datadog/__init__.py +55 -0
- mage_integrations/sources/datadog/client.py +18 -0
- mage_integrations/sources/datadog/schemas/audit_logs.json +49 -0
- mage_integrations/sources/datadog/schemas/dashboards.json +55 -0
- mage_integrations/sources/datadog/schemas/downtimes.json +103 -0
- mage_integrations/sources/datadog/schemas/incident_teams.json +92 -0
- mage_integrations/sources/datadog/schemas/incidents.json +135 -0
- mage_integrations/sources/datadog/schemas/logs.json +61 -0
- mage_integrations/sources/datadog/schemas/synthetic_tests.json +105 -0
- mage_integrations/sources/datadog/schemas/users.json +76 -0
- mage_integrations/sources/datadog/streams/__init__.py +275 -0
- mage_integrations/sources/datadog/templates/config.json +9 -0
- mage_integrations/sources/doris/README.md +28 -0
- mage_integrations/sources/doris/__init__.py +68 -0
- mage_integrations/sources/doris/templates/config.json +13 -0
- mage_integrations/sources/dremio/README.md +44 -0
- mage_integrations/sources/dremio/__init__.py +174 -0
- mage_integrations/sources/dremio/templates/config.json +6 -0
- mage_integrations/sources/dremio/utils.py +28 -0
- mage_integrations/sources/dynamodb/README.md +14 -0
- mage_integrations/sources/dynamodb/__init__.py +225 -0
- mage_integrations/sources/dynamodb/templates/config.json +6 -0
- mage_integrations/sources/facebook_ads/README.md +49 -0
- mage_integrations/sources/facebook_ads/__init__.py +45 -0
- mage_integrations/sources/facebook_ads/tap_facebook/__init__.py +1040 -0
- mage_integrations/sources/facebook_ads/tap_facebook/process_output.py +114 -0
- mage_integrations/sources/facebook_ads/tap_facebook/schemas/adcreative.json +1440 -0
- mage_integrations/sources/facebook_ads/tap_facebook/schemas/ads.json +859 -0
- mage_integrations/sources/facebook_ads/tap_facebook/schemas/ads_insights.json +339 -0
- mage_integrations/sources/facebook_ads/tap_facebook/schemas/ads_insights_age_and_gender.json +352 -0
- mage_integrations/sources/facebook_ads/tap_facebook/schemas/ads_insights_country.json +345 -0
- mage_integrations/sources/facebook_ads/tap_facebook/schemas/ads_insights_dma.json +183 -0
- mage_integrations/sources/facebook_ads/tap_facebook/schemas/ads_insights_hourly_advertiser.json +311 -0
- mage_integrations/sources/facebook_ads/tap_facebook/schemas/ads_insights_platform_and_device.json +363 -0
- mage_integrations/sources/facebook_ads/tap_facebook/schemas/ads_insights_region.json +345 -0
- mage_integrations/sources/facebook_ads/tap_facebook/schemas/adsets.json +200 -0
- mage_integrations/sources/facebook_ads/tap_facebook/schemas/campaigns.json +98 -0
- mage_integrations/sources/facebook_ads/tap_facebook/schemas/leads.json +65 -0
- mage_integrations/sources/facebook_ads/tap_facebook/schemas/shared/ads_action_stats.json +74 -0
- mage_integrations/sources/facebook_ads/tap_facebook/schemas/shared/ads_histogram_stats.json +32 -0
- mage_integrations/sources/facebook_ads/tap_facebook/schemas/shared/ads_image_crops.json +134 -0
- mage_integrations/sources/facebook_ads/tap_facebook/schemas/shared/geo_locations.json +270 -0
- mage_integrations/sources/facebook_ads/tap_facebook/schemas/shared/targeting.json +401 -0
- mage_integrations/sources/facebook_ads/templates/config.json +5 -0
- mage_integrations/sources/facebook_ads/tests/base.py +396 -0
- mage_integrations/sources/facebook_ads/tests/facebook_ads/adcreative/output/00000000000000000000 +8 -0
- mage_integrations/sources/facebook_ads/tests/facebook_ads/ads/output/00000000000000000000 +10 -0
- mage_integrations/sources/facebook_ads/tests/facebook_ads/adsets/output/00000000000000000000 +11 -0
- mage_integrations/sources/facebook_ads/tests/facebook_ads/campaigns/output/00000000000000000000 +14 -0
- mage_integrations/sources/facebook_ads/tests/test_facebook_archived_data.py +115 -0
- mage_integrations/sources/facebook_ads/tests/test_facebook_attribution_window.py +104 -0
- mage_integrations/sources/facebook_ads/tests/test_facebook_automatic_fields.py +85 -0
- mage_integrations/sources/facebook_ads/tests/test_facebook_bookmarks.py +256 -0
- mage_integrations/sources/facebook_ads/tests/test_facebook_discovery.py +122 -0
- mage_integrations/sources/facebook_ads/tests/test_facebook_field_selection.py +118 -0
- mage_integrations/sources/facebook_ads/tests/test_facebook_invalid_attribution_window.py +65 -0
- mage_integrations/sources/facebook_ads/tests/test_facebook_start_date.py +145 -0
- mage_integrations/sources/facebook_ads/tests/unittests/test_attribute_error_retry.py +193 -0
- mage_integrations/sources/facebook_ads/tests/unittests/test_attribution_window.py +29 -0
- mage_integrations/sources/facebook_ads/tests/unittests/test_request_timeout.py +504 -0
- mage_integrations/sources/facebook_ads/tests/unittests/test_retry_logic.py +261 -0
- mage_integrations/sources/facebook_ads/tests/unittests/test_sync_batches_retry.py +154 -0
- mage_integrations/sources/facebook_ads/tests/unittests/test_tap_facebook.py +160 -0
- mage_integrations/sources/freshdesk/README.md +24 -0
- mage_integrations/sources/freshdesk/__init__.py +25 -0
- mage_integrations/sources/freshdesk/tap_freshdesk/__init__.py +325 -0
- mage_integrations/sources/freshdesk/tap_freshdesk/schemas/agents.json +85 -0
- mage_integrations/sources/freshdesk/tap_freshdesk/schemas/companies.json +45 -0
- mage_integrations/sources/freshdesk/tap_freshdesk/schemas/contacts.json +165 -0
- mage_integrations/sources/freshdesk/tap_freshdesk/schemas/conversations.json +178 -0
- mage_integrations/sources/freshdesk/tap_freshdesk/schemas/groups.json +40 -0
- mage_integrations/sources/freshdesk/tap_freshdesk/schemas/roles.json +25 -0
- mage_integrations/sources/freshdesk/tap_freshdesk/schemas/satisfaction_ratings.json +75 -0
- mage_integrations/sources/freshdesk/tap_freshdesk/schemas/tickets.json +332 -0
- mage_integrations/sources/freshdesk/tap_freshdesk/schemas/time_entries.json +72 -0
- mage_integrations/sources/freshdesk/tap_freshdesk/utils.py +93 -0
- mage_integrations/sources/freshdesk/templates/config.json +5 -0
- mage_integrations/sources/freshdesk/tests/base.py +262 -0
- mage_integrations/sources/freshdesk/tests/test_freshdesk_bookmarks.py +250 -0
- mage_integrations/sources/freshdesk/tests/test_freshdesk_check.py +29 -0
- mage_integrations/sources/freshdesk/tests/test_freshdesk_pagination.py +58 -0
- mage_integrations/sources/freshdesk/tests/test_freshdesk_start_date.py +181 -0
- mage_integrations/sources/front/README.md +25 -0
- mage_integrations/sources/front/__init__.py +40 -0
- mage_integrations/sources/front/client.py +76 -0
- mage_integrations/sources/front/context.py +62 -0
- mage_integrations/sources/front/schemas/accounts.json +37 -0
- mage_integrations/sources/front/schemas/analytics.json +71 -0
- mage_integrations/sources/front/schemas/channels.json +28 -0
- mage_integrations/sources/front/schemas/contact_groups.json +15 -0
- mage_integrations/sources/front/schemas/contacts.json +49 -0
- mage_integrations/sources/front/schemas/conversations.json +40 -0
- mage_integrations/sources/front/schemas/custom_fields.json +18 -0
- mage_integrations/sources/front/schemas/events.json +27 -0
- mage_integrations/sources/front/schemas/rules.json +21 -0
- mage_integrations/sources/front/schemas/tags.json +27 -0
- mage_integrations/sources/front/schemas/teammates.json +30 -0
- mage_integrations/sources/front/schemas/teams.json +12 -0
- mage_integrations/sources/front/schemas.py +43 -0
- mage_integrations/sources/front/streams/__init__.py +0 -0
- mage_integrations/sources/front/streams/accounts.py +7 -0
- mage_integrations/sources/front/streams/analytics.py +97 -0
- mage_integrations/sources/front/streams/base.py +29 -0
- mage_integrations/sources/front/streams/channels.py +7 -0
- mage_integrations/sources/front/streams/contact_groups.py +7 -0
- mage_integrations/sources/front/streams/contacts.py +7 -0
- mage_integrations/sources/front/streams/conversations.py +7 -0
- mage_integrations/sources/front/streams/custom_fields.py +7 -0
- mage_integrations/sources/front/streams/events.py +7 -0
- mage_integrations/sources/front/streams/rules.py +7 -0
- mage_integrations/sources/front/streams/tags.py +7 -0
- mage_integrations/sources/front/streams/teammates.py +7 -0
- mage_integrations/sources/front/streams/teams.py +7 -0
- mage_integrations/sources/front/templates/config.json +6 -0
- mage_integrations/sources/github/README.md +55 -0
- mage_integrations/sources/github/__init__.py +48 -0
- mage_integrations/sources/github/tap_github/__init__.py +47 -0
- mage_integrations/sources/github/tap_github/client.py +430 -0
- mage_integrations/sources/github/tap_github/discover.py +41 -0
- mage_integrations/sources/github/tap_github/schema.py +88 -0
- mage_integrations/sources/github/tap_github/schemas/assignees.json +72 -0
- mage_integrations/sources/github/tap_github/schemas/collaborators.json +75 -0
- mage_integrations/sources/github/tap_github/schemas/comments.json +120 -0
- mage_integrations/sources/github/tap_github/schemas/commit_comments.json +114 -0
- mage_integrations/sources/github/tap_github/schemas/commits.json +278 -0
- mage_integrations/sources/github/tap_github/schemas/events.json +1055 -0
- mage_integrations/sources/github/tap_github/schemas/issue_events.json +963 -0
- mage_integrations/sources/github/tap_github/schemas/issue_labels.json +29 -0
- mage_integrations/sources/github/tap_github/schemas/issue_milestones.json +125 -0
- mage_integrations/sources/github/tap_github/schemas/issues.json +276 -0
- mage_integrations/sources/github/tap_github/schemas/pr_commits.json +323 -0
- mage_integrations/sources/github/tap_github/schemas/project_cards.json +120 -0
- mage_integrations/sources/github/tap_github/schemas/project_columns.json +34 -0
- mage_integrations/sources/github/tap_github/schemas/projects.json +117 -0
- mage_integrations/sources/github/tap_github/schemas/pull_requests.json +1646 -0
- mage_integrations/sources/github/tap_github/schemas/releases.json +192 -0
- mage_integrations/sources/github/tap_github/schemas/review_comments.json +178 -0
- mage_integrations/sources/github/tap_github/schemas/reviews.json +70 -0
- mage_integrations/sources/github/tap_github/schemas/shared/issue_permissions.json +20 -0
- mage_integrations/sources/github/tap_github/schemas/shared/performed_via_github_app.json +61 -0
- mage_integrations/sources/github/tap_github/schemas/shared/pull_permissions.json +20 -0
- mage_integrations/sources/github/tap_github/schemas/shared/reactions.json +35 -0
- mage_integrations/sources/github/tap_github/schemas/shared/user.json +68 -0
- mage_integrations/sources/github/tap_github/schemas/stargazers.json +19 -0
- mage_integrations/sources/github/tap_github/schemas/team_members.json +74 -0
- mage_integrations/sources/github/tap_github/schemas/team_memberships.json +20 -0
- mage_integrations/sources/github/tap_github/schemas/teams.json +47 -0
- mage_integrations/sources/github/tap_github/streams.py +952 -0
- mage_integrations/sources/github/tap_github/sync.py +306 -0
- mage_integrations/sources/github/templates/config.json +7 -0
- mage_integrations/sources/github/tests/__init__.py +0 -0
- mage_integrations/sources/github/tests/base.py +445 -0
- mage_integrations/sources/google_ads/README.md +28 -0
- mage_integrations/sources/google_ads/__init__.py +41 -0
- mage_integrations/sources/google_ads/tap_google_ads/__init__.py +57 -0
- mage_integrations/sources/google_ads/tap_google_ads/client.py +17 -0
- mage_integrations/sources/google_ads/tap_google_ads/discover.py +268 -0
- mage_integrations/sources/google_ads/tap_google_ads/report_definitions.py +1877 -0
- mage_integrations/sources/google_ads/tap_google_ads/schemas/accounts.json +171 -0
- mage_integrations/sources/google_ads/tap_google_ads/schemas/ad_groups.json +268 -0
- mage_integrations/sources/google_ads/tap_google_ads/schemas/ads.json +1759 -0
- mage_integrations/sources/google_ads/tap_google_ads/schemas/campaigns.json +858 -0
- mage_integrations/sources/google_ads/tap_google_ads/streams.py +1170 -0
- mage_integrations/sources/google_ads/tap_google_ads/sync.py +144 -0
- mage_integrations/sources/google_ads/tap_google_ads/tests/base.py +434 -0
- mage_integrations/sources/google_ads/templates/config.json +13 -0
- mage_integrations/sources/google_analytics/README.md +31 -0
- mage_integrations/sources/google_analytics/__init__.py +128 -0
- mage_integrations/sources/google_analytics/templates/config.json +6 -0
- mage_integrations/sources/google_cloud_storage/README.md +40 -0
- mage_integrations/sources/google_cloud_storage/__init__.py +166 -0
- mage_integrations/sources/google_cloud_storage/templates/config.json +7 -0
- mage_integrations/sources/google_search_console/README.md +20 -0
- mage_integrations/sources/google_search_console/__init__.py +99 -0
- mage_integrations/sources/google_search_console/schemas/performance_report_country.json +31 -0
- mage_integrations/sources/google_search_console/schemas/performance_report_custom.json +40 -0
- mage_integrations/sources/google_search_console/schemas/performance_report_date.json +28 -0
- mage_integrations/sources/google_search_console/schemas/performance_report_device.json +31 -0
- mage_integrations/sources/google_search_console/schemas/performance_report_page.json +31 -0
- mage_integrations/sources/google_search_console/schemas/performance_report_query.json +31 -0
- mage_integrations/sources/google_search_console/streams.py +118 -0
- mage_integrations/sources/google_search_console/templates/config.json +6 -0
- mage_integrations/sources/google_sheets/README.md +24 -0
- mage_integrations/sources/google_sheets/__init__.py +460 -0
- mage_integrations/sources/google_sheets/templates/config.json +5 -0
- mage_integrations/sources/google_sheets/transform.py +297 -0
- mage_integrations/sources/http/__init__.py +0 -0
- mage_integrations/sources/http/client.py +179 -0
- mage_integrations/sources/hubspot/README.md +48 -0
- mage_integrations/sources/hubspot/__init__.py +41 -0
- mage_integrations/sources/hubspot/bin/run-a-test.sh +5 -0
- mage_integrations/sources/hubspot/bin/run-all-tests.sh +1 -0
- mage_integrations/sources/hubspot/tap_hubspot/__init__.py +1548 -0
- mage_integrations/sources/hubspot/tap_hubspot/constants.py +13 -0
- mage_integrations/sources/hubspot/tap_hubspot/schemas/campaigns.json +91 -0
- mage_integrations/sources/hubspot/tap_hubspot/schemas/companies.json +11 -0
- mage_integrations/sources/hubspot/tap_hubspot/schemas/contact_lists.json +97 -0
- mage_integrations/sources/hubspot/tap_hubspot/schemas/contacts.json +201 -0
- mage_integrations/sources/hubspot/tap_hubspot/schemas/contacts_by_company.json +12 -0
- mage_integrations/sources/hubspot/tap_hubspot/schemas/deal_pipelines.json +46 -0
- mage_integrations/sources/hubspot/tap_hubspot/schemas/deals.json +37 -0
- mage_integrations/sources/hubspot/tap_hubspot/schemas/email_events.json +118 -0
- mage_integrations/sources/hubspot/tap_hubspot/schemas/engagements.json +179 -0
- mage_integrations/sources/hubspot/tap_hubspot/schemas/forms.json +229 -0
- mage_integrations/sources/hubspot/tap_hubspot/schemas/owners.json +72 -0
- mage_integrations/sources/hubspot/tap_hubspot/schemas/subscription_changes.json +54 -0
- mage_integrations/sources/hubspot/tap_hubspot/schemas/versions.json +30 -0
- mage_integrations/sources/hubspot/tap_hubspot/schemas/workflows.json +48 -0
- mage_integrations/sources/hubspot/tap_hubspot/tests/__init__.py +0 -0
- mage_integrations/sources/hubspot/tap_hubspot/tests/test_bookmarks.py +62 -0
- mage_integrations/sources/hubspot/tap_hubspot/tests/test_deals.py +32 -0
- mage_integrations/sources/hubspot/tap_hubspot/tests/test_get_streams_to_sync.py +44 -0
- mage_integrations/sources/hubspot/tap_hubspot/tests/test_offsets.py +57 -0
- mage_integrations/sources/hubspot/tap_hubspot/tests/unittests/test_get_start.py +94 -0
- mage_integrations/sources/hubspot/tap_hubspot/tests/unittests/test_request_timeout.py +121 -0
- mage_integrations/sources/hubspot/tap_hubspot/tests/utils.py +80 -0
- mage_integrations/sources/hubspot/templates/config.json +6 -0
- mage_integrations/sources/hubspot/tests/base.py +383 -0
- mage_integrations/sources/hubspot/tests/client.py +1583 -0
- mage_integrations/sources/hubspot/tests/client_tester.py +280 -0
- mage_integrations/sources/hubspot/tests/test_hubspot_all_fields.py +323 -0
- mage_integrations/sources/hubspot/tests/test_hubspot_automatic_fields.py +109 -0
- mage_integrations/sources/hubspot/tests/test_hubspot_bookmarks.py +236 -0
- mage_integrations/sources/hubspot/tests/test_hubspot_bookmarks_static.py +127 -0
- mage_integrations/sources/hubspot/tests/test_hubspot_child_stream_only.py +88 -0
- mage_integrations/sources/hubspot/tests/test_hubspot_discovery.py +131 -0
- mage_integrations/sources/hubspot/tests/test_hubspot_interrupted_sync.py +137 -0
- mage_integrations/sources/hubspot/tests/test_hubspot_interrupted_sync_offset.py +135 -0
- mage_integrations/sources/hubspot/tests/test_hubspot_pagination.py +140 -0
- mage_integrations/sources/hubspot/tests/test_hubspot_start_date.py +179 -0
- mage_integrations/sources/hubspot/tests/unittests/test_deals.py +101 -0
- mage_integrations/sources/intercom/README.md +19 -0
- mage_integrations/sources/intercom/__init__.py +54 -0
- mage_integrations/sources/intercom/client.py +246 -0
- mage_integrations/sources/intercom/schema.py +57 -0
- mage_integrations/sources/intercom/schemas/admins.json +65 -0
- mage_integrations/sources/intercom/schemas/companies.json +106 -0
- mage_integrations/sources/intercom/schemas/company_attributes.json +63 -0
- mage_integrations/sources/intercom/schemas/company_segments.json +26 -0
- mage_integrations/sources/intercom/schemas/contact_attributes.json +104 -0
- mage_integrations/sources/intercom/schemas/contacts.json +534 -0
- mage_integrations/sources/intercom/schemas/conversation_parts.json +180 -0
- mage_integrations/sources/intercom/schemas/conversations.json +797 -0
- mage_integrations/sources/intercom/schemas/segments.json +26 -0
- mage_integrations/sources/intercom/schemas/tags.json +15 -0
- mage_integrations/sources/intercom/schemas/teams.json +28 -0
- mage_integrations/sources/intercom/streams.py +739 -0
- mage_integrations/sources/intercom/templates/config.json +4 -0
- mage_integrations/sources/intercom/transform.py +134 -0
- mage_integrations/sources/knowi/README.md +20 -0
- mage_integrations/sources/knowi/__init__.py +68 -0
- mage_integrations/sources/knowi/client.py +249 -0
- mage_integrations/sources/knowi/schema.py +60 -0
- mage_integrations/sources/knowi/schemas/dashboards.json +150 -0
- mage_integrations/sources/knowi/schemas/widgets.json +688 -0
- mage_integrations/sources/knowi/streams.py +190 -0
- mage_integrations/sources/knowi/templates/config.json +6 -0
- mage_integrations/sources/linkedin_ads/README.md +34 -0
- mage_integrations/sources/linkedin_ads/__init__.py +66 -0
- mage_integrations/sources/linkedin_ads/tap_linkedin_ads/__init__.py +65 -0
- mage_integrations/sources/linkedin_ads/tap_linkedin_ads/client.py +335 -0
- mage_integrations/sources/linkedin_ads/tap_linkedin_ads/discover.py +30 -0
- mage_integrations/sources/linkedin_ads/tap_linkedin_ads/schema.py +91 -0
- mage_integrations/sources/linkedin_ads/tap_linkedin_ads/schemas/account_users.json +91 -0
- mage_integrations/sources/linkedin_ads/tap_linkedin_ads/schemas/accounts.json +190 -0
- mage_integrations/sources/linkedin_ads/tap_linkedin_ads/schemas/ad_analytics_by_campaign.json +501 -0
- mage_integrations/sources/linkedin_ads/tap_linkedin_ads/schemas/ad_analytics_by_creative.json +501 -0
- mage_integrations/sources/linkedin_ads/tap_linkedin_ads/schemas/campaign_groups.json +133 -0
- mage_integrations/sources/linkedin_ads/tap_linkedin_ads/schemas/campaigns.json +469 -0
- mage_integrations/sources/linkedin_ads/tap_linkedin_ads/schemas/creatives.json +182 -0
- mage_integrations/sources/linkedin_ads/tap_linkedin_ads/schemas/video_ads.json +115 -0
- mage_integrations/sources/linkedin_ads/tap_linkedin_ads/sync.py +868 -0
- mage_integrations/sources/linkedin_ads/tap_linkedin_ads/transform.py +323 -0
- mage_integrations/sources/linkedin_ads/templates/config.json +9 -0
- mage_integrations/sources/linkedin_ads/tests/base.py +305 -0
- mage_integrations/sources/linkedin_ads/tests/test_all_fields.py +94 -0
- mage_integrations/sources/linkedin_ads/tests/test_discovery.py +95 -0
- mage_integrations/sources/linkedin_ads/tests/test_pagination.py +53 -0
- mage_integrations/sources/linkedin_ads/tests/test_start_date.py +130 -0
- mage_integrations/sources/linkedin_ads/tests/test_sync_canary.py +31 -0
- mage_integrations/sources/linkedin_ads/tests/test_sync_without_refrence_organization_id.py +31 -0
- mage_integrations/sources/linkedin_ads/tests/test_sync_without_refresh_token.py +131 -0
- mage_integrations/sources/linkedin_ads/tests/unittests/test_account_number.py +81 -0
- mage_integrations/sources/linkedin_ads/tests/unittests/test_adCampaignGroup_4XX.py +97 -0
- mage_integrations/sources/linkedin_ads/tests/unittests/test_client.py +94 -0
- mage_integrations/sources/linkedin_ads/tests/unittests/test_exception_handling.py +351 -0
- mage_integrations/sources/linkedin_ads/tests/unittests/test_fetch_access_token.py +36 -0
- mage_integrations/sources/linkedin_ads/tests/unittests/test_sync.py +197 -0
- mage_integrations/sources/linkedin_ads/tests/unittests/test_sync_endpoint.py +42 -0
- mage_integrations/sources/linkedin_ads/tests/unittests/test_timeout.py +279 -0
- mage_integrations/sources/messages.py +138 -0
- mage_integrations/sources/mode/README.md +21 -0
- mage_integrations/sources/mode/__init__.py +58 -0
- mage_integrations/sources/mode/client.py +251 -0
- mage_integrations/sources/mode/schema.py +57 -0
- mage_integrations/sources/mode/schemas/charts.json +116 -0
- mage_integrations/sources/mode/schemas/queries.json +41 -0
- mage_integrations/sources/mode/schemas/reports.json +128 -0
- mage_integrations/sources/mode/schemas/spaces.json +36 -0
- mage_integrations/sources/mode/streams.py +310 -0
- mage_integrations/sources/mode/templates/config.json +7 -0
- mage_integrations/sources/monday/README.md +24 -0
- mage_integrations/sources/monday/__init__.py +39 -0
- mage_integrations/sources/monday/client.py +35 -0
- mage_integrations/sources/monday/schemas/board_views.json +18 -0
- mage_integrations/sources/monday/schemas/boards.json +32 -0
- mage_integrations/sources/monday/schemas/columns.json +27 -0
- mage_integrations/sources/monday/schemas/groups.json +21 -0
- mage_integrations/sources/monday/schemas/workspaces.json +18 -0
- mage_integrations/sources/monday/streams.py +260 -0
- mage_integrations/sources/monday/templates/config.json +5 -0
- mage_integrations/sources/mongodb/README.md +33 -0
- mage_integrations/sources/mongodb/__init__.py +194 -0
- mage_integrations/sources/mongodb/schema.py +78 -0
- mage_integrations/sources/mongodb/spikes/atlas_setup.md +47 -0
- mage_integrations/sources/mongodb/spikes/dbreps_and_hackathon_review.md +46 -0
- mage_integrations/sources/mongodb/spikes/local_mongo_setup.md +92 -0
- mage_integrations/sources/mongodb/spikes/pymongo_spike.py +115 -0
- mage_integrations/sources/mongodb/spikes/supported_versions_spike.md +58 -0
- mage_integrations/sources/mongodb/tap_mongodb/__init__.py +465 -0
- mage_integrations/sources/mongodb/tap_mongodb/sync_strategies/common.py +354 -0
- mage_integrations/sources/mongodb/tap_mongodb/sync_strategies/full_table.py +162 -0
- mage_integrations/sources/mongodb/tap_mongodb/sync_strategies/incremental.py +125 -0
- mage_integrations/sources/mongodb/tap_mongodb/sync_strategies/oplog.py +271 -0
- mage_integrations/sources/mongodb/tap_mongodb/sync_strategies/utils.py +39 -0
- mage_integrations/sources/mongodb/templates/config.json +7 -0
- mage_integrations/sources/mongodb/tests/__init__.py +0 -0
- mage_integrations/sources/mongodb/tests/mongodb_common.py +37 -0
- mage_integrations/sources/mongodb/tests/test_mongodb_cname_restrictions.py +252 -0
- mage_integrations/sources/mongodb/tests/test_mongodb_configurable_properties.py +195 -0
- mage_integrations/sources/mongodb/tests/test_mongodb_datatype.py +246 -0
- mage_integrations/sources/mongodb/tests/test_mongodb_discovery.py +272 -0
- mage_integrations/sources/mongodb/tests/test_mongodb_fname_restrictions.py +302 -0
- mage_integrations/sources/mongodb/tests/test_mongodb_full_table.py +288 -0
- mage_integrations/sources/mongodb/tests/test_mongodb_full_table_id.py +227 -0
- mage_integrations/sources/mongodb/tests/test_mongodb_full_table_interruptible.py +232 -0
- mage_integrations/sources/mongodb/tests/test_mongodb_id_pk_variations.py +273 -0
- mage_integrations/sources/mongodb/tests/test_mongodb_incremental.py +480 -0
- mage_integrations/sources/mongodb/tests/test_mongodb_incremental_open_transactions.py +312 -0
- mage_integrations/sources/mongodb/tests/test_mongodb_index.py +162 -0
- mage_integrations/sources/mongodb/tests/test_mongodb_log_based_interruptible.py +328 -0
- mage_integrations/sources/mongodb/tests/test_mongodb_namespace_restrictions.py +258 -0
- mage_integrations/sources/mongodb/tests/test_mongodb_oplog.py +260 -0
- mage_integrations/sources/mongodb/tests/test_mongodb_oplog_aged_out.py +181 -0
- mage_integrations/sources/mongodb/tests/test_mongodb_oplog_bookmarks.py +245 -0
- mage_integrations/sources/mongodb/tests/test_mongodb_projection.py +271 -0
- mage_integrations/sources/mongodb/tests/test_mongodb_table_reset_inc.py +300 -0
- mage_integrations/sources/mongodb/tests/test_mongodb_table_reset_log.py +209 -0
- mage_integrations/sources/mongodb/tests/test_mongodb_views.py +159 -0
- mage_integrations/sources/mongodb/tests/unittests/test_common.py +436 -0
- mage_integrations/sources/mssql/README.md +28 -0
- mage_integrations/sources/mssql/__init__.py +88 -0
- mage_integrations/sources/mssql/templates/config.json +9 -0
- mage_integrations/sources/mysql/README.md +32 -0
- mage_integrations/sources/mysql/__init__.py +70 -0
- mage_integrations/sources/mysql/templates/config.json +13 -0
- mage_integrations/sources/oracledb/README.md +22 -0
- mage_integrations/sources/oracledb/__init__.py +152 -0
- mage_integrations/sources/oracledb/templates/config.json +8 -0
- mage_integrations/sources/outreach/README.md +68 -0
- mage_integrations/sources/outreach/__init__.py +47 -0
- mage_integrations/sources/outreach/tap_outreach/__init__.py +50 -0
- mage_integrations/sources/outreach/tap_outreach/client.py +131 -0
- mage_integrations/sources/outreach/tap_outreach/discover.py +87 -0
- mage_integrations/sources/outreach/tap_outreach/schemas/accounts.json +356 -0
- mage_integrations/sources/outreach/tap_outreach/schemas/call_dispositions.json +49 -0
- mage_integrations/sources/outreach/tap_outreach/schemas/call_purposes.json +43 -0
- mage_integrations/sources/outreach/tap_outreach/schemas/calls.json +179 -0
- mage_integrations/sources/outreach/tap_outreach/schemas/content_categories.json +55 -0
- mage_integrations/sources/outreach/tap_outreach/schemas/duties.json +23 -0
- mage_integrations/sources/outreach/tap_outreach/schemas/events.json +97 -0
- mage_integrations/sources/outreach/tap_outreach/schemas/mailboxes.json +306 -0
- mage_integrations/sources/outreach/tap_outreach/schemas/mailings.json +283 -0
- mage_integrations/sources/outreach/tap_outreach/schemas/opportunities.json +724 -0
- mage_integrations/sources/outreach/tap_outreach/schemas/personas.json +37 -0
- mage_integrations/sources/outreach/tap_outreach/schemas/prospects.json +906 -0
- mage_integrations/sources/outreach/tap_outreach/schemas/sequence_states.json +161 -0
- mage_integrations/sources/outreach/tap_outreach/schemas/sequence_steps.json +152 -0
- mage_integrations/sources/outreach/tap_outreach/schemas/sequence_templates.json +122 -0
- mage_integrations/sources/outreach/tap_outreach/schemas/sequences.json +275 -0
- mage_integrations/sources/outreach/tap_outreach/schemas/stages.json +55 -0
- mage_integrations/sources/outreach/tap_outreach/schemas/tasks.json +186 -0
- mage_integrations/sources/outreach/tap_outreach/schemas/teams.json +30 -0
- mage_integrations/sources/outreach/tap_outreach/schemas/users.json +361 -0
- mage_integrations/sources/outreach/tap_outreach/sync.py +378 -0
- mage_integrations/sources/outreach/templates/config.json +7 -0
- mage_integrations/sources/paystack/README.md +15 -0
- mage_integrations/sources/paystack/__init__.py +44 -0
- mage_integrations/sources/paystack/client.py +14 -0
- mage_integrations/sources/paystack/schemas/customers.json +45 -0
- mage_integrations/sources/paystack/schemas/transactions.json +170 -0
- mage_integrations/sources/paystack/streams/__init__.py +8 -0
- mage_integrations/sources/paystack/streams/base.py +122 -0
- mage_integrations/sources/paystack/streams/customers.py +18 -0
- mage_integrations/sources/paystack/streams/transactions.py +18 -0
- mage_integrations/sources/paystack/templates/config.json +5 -0
- mage_integrations/sources/pipedrive/README.md +14 -0
- mage_integrations/sources/pipedrive/__init__.py +38 -0
- mage_integrations/sources/pipedrive/tap_pipedrive/__init__.py +1 -0
- mage_integrations/sources/pipedrive/tap_pipedrive/cli.py +32 -0
- mage_integrations/sources/pipedrive/tap_pipedrive/config.py +5 -0
- mage_integrations/sources/pipedrive/tap_pipedrive/exceptions.py +46 -0
- mage_integrations/sources/pipedrive/tap_pipedrive/schemas/activity_types.json +37 -0
- mage_integrations/sources/pipedrive/tap_pipedrive/schemas/currency.json +26 -0
- mage_integrations/sources/pipedrive/tap_pipedrive/schemas/deal_products.json +125 -0
- mage_integrations/sources/pipedrive/tap_pipedrive/schemas/dealflow.json +45 -0
- mage_integrations/sources/pipedrive/tap_pipedrive/schemas/filters.json +37 -0
- mage_integrations/sources/pipedrive/tap_pipedrive/schemas/pipelines.json +31 -0
- mage_integrations/sources/pipedrive/tap_pipedrive/schemas/recents/dynamic_typing/activities.json +112 -0
- mage_integrations/sources/pipedrive/tap_pipedrive/schemas/recents/dynamic_typing/deals.json +197 -0
- mage_integrations/sources/pipedrive/tap_pipedrive/schemas/recents/dynamic_typing/notes.json +90 -0
- mage_integrations/sources/pipedrive/tap_pipedrive/schemas/recents/dynamic_typing/organizations.json +156 -0
- mage_integrations/sources/pipedrive/tap_pipedrive/schemas/recents/dynamic_typing/persons.json +174 -0
- mage_integrations/sources/pipedrive/tap_pipedrive/schemas/recents/dynamic_typing/products.json +81 -0
- mage_integrations/sources/pipedrive/tap_pipedrive/schemas/recents/files.json +97 -0
- mage_integrations/sources/pipedrive/tap_pipedrive/schemas/recents/users.json +75 -0
- mage_integrations/sources/pipedrive/tap_pipedrive/schemas/stages.json +40 -0
- mage_integrations/sources/pipedrive/tap_pipedrive/stream.py +195 -0
- mage_integrations/sources/pipedrive/tap_pipedrive/streams/__init__.py +22 -0
- mage_integrations/sources/pipedrive/tap_pipedrive/streams/activity_types.py +9 -0
- mage_integrations/sources/pipedrive/tap_pipedrive/streams/currencies.py +7 -0
- mage_integrations/sources/pipedrive/tap_pipedrive/streams/deal_products.py +17 -0
- mage_integrations/sources/pipedrive/tap_pipedrive/streams/dealflow.py +24 -0
- mage_integrations/sources/pipedrive/tap_pipedrive/streams/filters.py +9 -0
- mage_integrations/sources/pipedrive/tap_pipedrive/streams/notes.py +8 -0
- mage_integrations/sources/pipedrive/tap_pipedrive/streams/pipelines.py +9 -0
- mage_integrations/sources/pipedrive/tap_pipedrive/streams/recents/__init__.py +36 -0
- mage_integrations/sources/pipedrive/tap_pipedrive/streams/recents/dynamic_typing/__init__.py +86 -0
- mage_integrations/sources/pipedrive/tap_pipedrive/streams/recents/dynamic_typing/activities.py +16 -0
- mage_integrations/sources/pipedrive/tap_pipedrive/streams/recents/dynamic_typing/deals.py +22 -0
- mage_integrations/sources/pipedrive/tap_pipedrive/streams/recents/dynamic_typing/notes.py +14 -0
- mage_integrations/sources/pipedrive/tap_pipedrive/streams/recents/dynamic_typing/organizations.py +22 -0
- mage_integrations/sources/pipedrive/tap_pipedrive/streams/recents/dynamic_typing/persons.py +21 -0
- mage_integrations/sources/pipedrive/tap_pipedrive/streams/recents/dynamic_typing/products.py +13 -0
- mage_integrations/sources/pipedrive/tap_pipedrive/streams/recents/files.py +10 -0
- mage_integrations/sources/pipedrive/tap_pipedrive/streams/recents/users.py +21 -0
- mage_integrations/sources/pipedrive/tap_pipedrive/streams/stages.py +9 -0
- mage_integrations/sources/pipedrive/tap_pipedrive/tap.py +426 -0
- mage_integrations/sources/pipedrive/templates/config.json +4 -0
- mage_integrations/sources/postgresql/README.md +34 -0
- mage_integrations/sources/postgresql/__init__.py +499 -0
- mage_integrations/sources/postgresql/decoders.py +396 -0
- mage_integrations/sources/postgresql/templates/config.json +10 -0
- mage_integrations/sources/postmark/README.md +20 -0
- mage_integrations/sources/postmark/__init__.py +43 -0
- mage_integrations/sources/postmark/tap_postmark/__init__.py +4 -0
- mage_integrations/sources/postmark/tap_postmark/cleaners.py +331 -0
- mage_integrations/sources/postmark/tap_postmark/discover.py +55 -0
- mage_integrations/sources/postmark/tap_postmark/postmark.py +552 -0
- mage_integrations/sources/postmark/tap_postmark/schema.py +40 -0
- mage_integrations/sources/postmark/tap_postmark/schemas/messages_opens.json +134 -0
- mage_integrations/sources/postmark/tap_postmark/schemas/messages_outbound.json +93 -0
- mage_integrations/sources/postmark/tap_postmark/schemas/stats_outbound_bounces.json +81 -0
- mage_integrations/sources/postmark/tap_postmark/schemas/stats_outbound_clients.json +19 -0
- mage_integrations/sources/postmark/tap_postmark/schemas/stats_outbound_overview.json +88 -0
- mage_integrations/sources/postmark/tap_postmark/schemas/stats_outbound_platform.json +46 -0
- mage_integrations/sources/postmark/tap_postmark/streams.py +535 -0
- mage_integrations/sources/postmark/tap_postmark/sync.py +124 -0
- mage_integrations/sources/postmark/tap_postmark/tap.py +51 -0
- mage_integrations/sources/postmark/tap_postmark/tools.py +87 -0
- mage_integrations/sources/postmark/templates/config.json +4 -0
- mage_integrations/sources/powerbi/README.md +20 -0
- mage_integrations/sources/powerbi/__init__.py +68 -0
- mage_integrations/sources/powerbi/client.py +249 -0
- mage_integrations/sources/powerbi/schema.py +60 -0
- mage_integrations/sources/powerbi/schemas/apps.json +22 -0
- mage_integrations/sources/powerbi/schemas/dashboards.json +36 -0
- mage_integrations/sources/powerbi/schemas/datasets.json +31 -0
- mage_integrations/sources/powerbi/schemas/groups.json +34 -0
- mage_integrations/sources/powerbi/schemas/reports.json +25 -0
- mage_integrations/sources/powerbi/schemas/tiles.json +31 -0
- mage_integrations/sources/powerbi/streams.py +365 -0
- mage_integrations/sources/powerbi/templates/config.json +6 -0
- mage_integrations/sources/query.py +23 -0
- mage_integrations/sources/redshift/README.md +36 -0
- mage_integrations/sources/redshift/__init__.py +143 -0
- mage_integrations/sources/redshift/constants.py +57 -0
- mage_integrations/sources/redshift/templates/config.json +9 -0
- mage_integrations/sources/redshift/utils.py +26 -0
- mage_integrations/sources/salesforce/README.md +149 -0
- mage_integrations/sources/salesforce/__init__.py +77 -0
- mage_integrations/sources/salesforce/client/LICENSE +620 -0
- mage_integrations/sources/salesforce/client/__init__.py +0 -0
- mage_integrations/sources/salesforce/client/tap_salesforce/__init__.py +616 -0
- mage_integrations/sources/salesforce/client/tap_salesforce/salesforce/__init__.py +400 -0
- mage_integrations/sources/salesforce/client/tap_salesforce/salesforce/bulk.py +353 -0
- mage_integrations/sources/salesforce/client/tap_salesforce/salesforce/credentials.py +112 -0
- mage_integrations/sources/salesforce/client/tap_salesforce/salesforce/exceptions.py +8 -0
- mage_integrations/sources/salesforce/client/tap_salesforce/salesforce/rest.py +109 -0
- mage_integrations/sources/salesforce/client/tap_salesforce/sync.py +221 -0
- mage_integrations/sources/salesforce/templates/config.json +10 -0
- mage_integrations/sources/sftp/LICENSE +620 -0
- mage_integrations/sources/sftp/README.md +47 -0
- mage_integrations/sources/sftp/__init__.py +39 -0
- mage_integrations/sources/sftp/tap_sftp/__init__.py +0 -0
- mage_integrations/sources/sftp/tap_sftp/aws_ssm.py +24 -0
- mage_integrations/sources/sftp/tap_sftp/client.py +217 -0
- mage_integrations/sources/sftp/tap_sftp/decrypt.py +24 -0
- mage_integrations/sources/sftp/tap_sftp/discover.py +32 -0
- mage_integrations/sources/sftp/tap_sftp/singer_encodings/__init__.py +0 -0
- mage_integrations/sources/sftp/tap_sftp/singer_encodings/compression.py +20 -0
- mage_integrations/sources/sftp/tap_sftp/singer_encodings/csv_handler.py +58 -0
- mage_integrations/sources/sftp/tap_sftp/singer_encodings/json_schema.py +204 -0
- mage_integrations/sources/sftp/tap_sftp/stats.py +44 -0
- mage_integrations/sources/sftp/tap_sftp/sync.py +122 -0
- mage_integrations/sources/sftp/tap_sftp/tap.py +97 -0
- mage_integrations/sources/sftp/templates/config.json +22 -0
- mage_integrations/sources/snowflake/README.md +36 -0
- mage_integrations/sources/snowflake/__init__.py +63 -0
- mage_integrations/sources/snowflake/constants.py +0 -0
- mage_integrations/sources/snowflake/templates/config.json +11 -0
- mage_integrations/sources/sql/__init__.py +0 -0
- mage_integrations/sources/sql/base.py +464 -0
- mage_integrations/sources/sql/constants.py +10 -0
- mage_integrations/sources/sql/utils.py +77 -0
- mage_integrations/sources/stripe/README.md +43 -0
- mage_integrations/sources/stripe/__init__.py +1297 -0
- mage_integrations/sources/stripe/schemas/balance_transactions.json +145 -0
- mage_integrations/sources/stripe/schemas/charges.json +1 -0
- mage_integrations/sources/stripe/schemas/coupons.json +120 -0
- mage_integrations/sources/stripe/schemas/customers.json +501 -0
- mage_integrations/sources/stripe/schemas/disputes.json +210 -0
- mage_integrations/sources/stripe/schemas/events.json +68 -0
- mage_integrations/sources/stripe/schemas/invoice_items.json +251 -0
- mage_integrations/sources/stripe/schemas/invoice_line_items.json +504 -0
- mage_integrations/sources/stripe/schemas/invoices.json +966 -0
- mage_integrations/sources/stripe/schemas/payment_intents.json +1101 -0
- mage_integrations/sources/stripe/schemas/payout_transactions.json +20 -0
- mage_integrations/sources/stripe/schemas/payouts.json +280 -0
- mage_integrations/sources/stripe/schemas/plans.json +1 -0
- mage_integrations/sources/stripe/schemas/products.json +181 -0
- mage_integrations/sources/stripe/schemas/shared/charge.json +1896 -0
- mage_integrations/sources/stripe/schemas/shared/discount.json +177 -0
- mage_integrations/sources/stripe/schemas/shared/plan.json +190 -0
- mage_integrations/sources/stripe/schemas/shared/source.json +573 -0
- mage_integrations/sources/stripe/schemas/shared/tax_ids.json +84 -0
- mage_integrations/sources/stripe/schemas/subscription_items.json +456 -0
- mage_integrations/sources/stripe/schemas/subscriptions.json +494 -0
- mage_integrations/sources/stripe/schemas/transfers.json +170 -0
- mage_integrations/sources/stripe/templates/config.json +5 -0
- mage_integrations/sources/tableau/README.md +22 -0
- mage_integrations/sources/tableau/__init__.py +71 -0
- mage_integrations/sources/tableau/client.py +251 -0
- mage_integrations/sources/tableau/schema.py +60 -0
- mage_integrations/sources/tableau/schemas/views.json +50 -0
- mage_integrations/sources/tableau/schemas/workbooks.json +250 -0
- mage_integrations/sources/tableau/streams.py +193 -0
- mage_integrations/sources/tableau/templates/config.json +7 -0
- mage_integrations/sources/teradata/README.md +24 -0
- mage_integrations/sources/teradata/__init__.py +255 -0
- mage_integrations/sources/teradata/templates/config.json +7 -0
- mage_integrations/sources/titanic/README.md +0 -0
- mage_integrations/sources/titanic/__init__.py +34 -0
- mage_integrations/sources/titanic/schemas/passengers.json +81 -0
- mage_integrations/sources/titanic/templates/config.json +4 -0
- mage_integrations/sources/twitter_ads/README.md +29 -0
- mage_integrations/sources/twitter_ads/__init__.py +56 -0
- mage_integrations/sources/twitter_ads/tap_twitter_ads/__init__.py +132 -0
- mage_integrations/sources/twitter_ads/tap_twitter_ads/client.py +108 -0
- mage_integrations/sources/twitter_ads/tap_twitter_ads/discover.py +31 -0
- mage_integrations/sources/twitter_ads/tap_twitter_ads/schema.py +223 -0
- mage_integrations/sources/twitter_ads/tap_twitter_ads/schemas/account_media.json +74 -0
- mage_integrations/sources/twitter_ads/tap_twitter_ads/schemas/accounts.json +45 -0
- mage_integrations/sources/twitter_ads/tap_twitter_ads/schemas/advertiser_business_categories.json +25 -0
- mage_integrations/sources/twitter_ads/tap_twitter_ads/schemas/campaigns.json +69 -0
- mage_integrations/sources/twitter_ads/tap_twitter_ads/schemas/cards.json +37 -0
- mage_integrations/sources/twitter_ads/tap_twitter_ads/schemas/cards_image_conversation.json +56 -0
- mage_integrations/sources/twitter_ads/tap_twitter_ads/schemas/cards_poll.json +73 -0
- mage_integrations/sources/twitter_ads/tap_twitter_ads/schemas/cards_video_conversation.json +62 -0
- mage_integrations/sources/twitter_ads/tap_twitter_ads/schemas/content_categories.json +25 -0
- mage_integrations/sources/twitter_ads/tap_twitter_ads/schemas/funding_instruments.json +71 -0
- mage_integrations/sources/twitter_ads/tap_twitter_ads/schemas/iab_categories.json +15 -0
- mage_integrations/sources/twitter_ads/tap_twitter_ads/schemas/line_item_apps.json +32 -0
- mage_integrations/sources/twitter_ads/tap_twitter_ads/schemas/line_items.json +127 -0
- mage_integrations/sources/twitter_ads/tap_twitter_ads/schemas/media_creatives.json +38 -0
- mage_integrations/sources/twitter_ads/tap_twitter_ads/schemas/preroll_call_to_actions.json +32 -0
- mage_integrations/sources/twitter_ads/tap_twitter_ads/schemas/promotable_users.json +26 -0
- mage_integrations/sources/twitter_ads/tap_twitter_ads/schemas/promoted_accounts.json +35 -0
- mage_integrations/sources/twitter_ads/tap_twitter_ads/schemas/promoted_tweets.json +35 -0
- mage_integrations/sources/twitter_ads/tap_twitter_ads/schemas/scheduled_promoted_tweets.json +32 -0
- mage_integrations/sources/twitter_ads/tap_twitter_ads/schemas/shared/billing.json +12 -0
- mage_integrations/sources/twitter_ads/tap_twitter_ads/schemas/shared/dimensions.json +87 -0
- mage_integrations/sources/twitter_ads/tap_twitter_ads/schemas/shared/engagement_all.json +39 -0
- mage_integrations/sources/twitter_ads/tap_twitter_ads/schemas/shared/engagement_basic.json +24 -0
- mage_integrations/sources/twitter_ads/tap_twitter_ads/schemas/shared/media.json +12 -0
- mage_integrations/sources/twitter_ads/tap_twitter_ads/schemas/shared/mobile_conversion.json +60 -0
- mage_integrations/sources/twitter_ads/tap_twitter_ads/schemas/shared/mobile_conversion_obj.json +21 -0
- mage_integrations/sources/twitter_ads/tap_twitter_ads/schemas/shared/report_account.json +23 -0
- mage_integrations/sources/twitter_ads/tap_twitter_ads/schemas/shared/report_funding_instrument.json +26 -0
- mage_integrations/sources/twitter_ads/tap_twitter_ads/schemas/shared/report_mobile_conversion.json +23 -0
- mage_integrations/sources/twitter_ads/tap_twitter_ads/schemas/shared/report_organic_tweet.json +26 -0
- mage_integrations/sources/twitter_ads/tap_twitter_ads/schemas/shared/report_other.json +38 -0
- mage_integrations/sources/twitter_ads/tap_twitter_ads/schemas/shared/report_web_conversion.json +23 -0
- mage_integrations/sources/twitter_ads/tap_twitter_ads/schemas/shared/video.json +36 -0
- mage_integrations/sources/twitter_ads/tap_twitter_ads/schemas/shared/web_conversion.json +21 -0
- mage_integrations/sources/twitter_ads/tap_twitter_ads/schemas/shared/web_conversion_obj.json +36 -0
- mage_integrations/sources/twitter_ads/tap_twitter_ads/schemas/tailored_audiences.json +70 -0
- mage_integrations/sources/twitter_ads/tap_twitter_ads/schemas/targeting_app_store_categories.json +18 -0
- mage_integrations/sources/twitter_ads/tap_twitter_ads/schemas/targeting_conversations.json +18 -0
- mage_integrations/sources/twitter_ads/tap_twitter_ads/schemas/targeting_criteria.json +44 -0
- mage_integrations/sources/twitter_ads/tap_twitter_ads/schemas/targeting_devices.json +21 -0
- mage_integrations/sources/twitter_ads/tap_twitter_ads/schemas/targeting_events.json +123 -0
- mage_integrations/sources/twitter_ads/tap_twitter_ads/schemas/targeting_interests.json +15 -0
- mage_integrations/sources/twitter_ads/tap_twitter_ads/schemas/targeting_languages.json +15 -0
- mage_integrations/sources/twitter_ads/tap_twitter_ads/schemas/targeting_locations.json +21 -0
- mage_integrations/sources/twitter_ads/tap_twitter_ads/schemas/targeting_network_operators.json +18 -0
- mage_integrations/sources/twitter_ads/tap_twitter_ads/schemas/targeting_platform_versions.json +21 -0
- mage_integrations/sources/twitter_ads/tap_twitter_ads/schemas/targeting_platforms.json +15 -0
- mage_integrations/sources/twitter_ads/tap_twitter_ads/schemas/targeting_tv_markets.json +15 -0
- mage_integrations/sources/twitter_ads/tap_twitter_ads/schemas/targeting_tv_shows.json +37 -0
- mage_integrations/sources/twitter_ads/tap_twitter_ads/schemas/tracking_tags.json +30 -0
- mage_integrations/sources/twitter_ads/tap_twitter_ads/schemas/tweets.json +920 -0
- mage_integrations/sources/twitter_ads/tap_twitter_ads/streams.py +1875 -0
- mage_integrations/sources/twitter_ads/tap_twitter_ads/sync.py +176 -0
- mage_integrations/sources/twitter_ads/tap_twitter_ads/transform.py +165 -0
- mage_integrations/sources/twitter_ads/templates/config.json +27 -0
- mage_integrations/sources/utils.py +318 -0
- mage_integrations/sources/zendesk/README.md +64 -0
- mage_integrations/sources/zendesk/__init__.py +45 -0
- mage_integrations/sources/zendesk/spikes/ticket_events.py +138 -0
- mage_integrations/sources/zendesk/tap_zendesk/__init__.py +253 -0
- mage_integrations/sources/zendesk/tap_zendesk/discover.py +80 -0
- mage_integrations/sources/zendesk/tap_zendesk/http.py +253 -0
- mage_integrations/sources/zendesk/tap_zendesk/metrics.py +102 -0
- mage_integrations/sources/zendesk/tap_zendesk/schemas/group_memberships.json +52 -0
- mage_integrations/sources/zendesk/tap_zendesk/schemas/groups.json +46 -0
- mage_integrations/sources/zendesk/tap_zendesk/schemas/macros.json +116 -0
- mage_integrations/sources/zendesk/tap_zendesk/schemas/organizations.json +114 -0
- mage_integrations/sources/zendesk/tap_zendesk/schemas/satisfaction_ratings.json +49 -0
- mage_integrations/sources/zendesk/tap_zendesk/schemas/shared/attachments.json +148 -0
- mage_integrations/sources/zendesk/tap_zendesk/schemas/shared/metadata.json +145 -0
- mage_integrations/sources/zendesk/tap_zendesk/schemas/shared/via.json +122 -0
- mage_integrations/sources/zendesk/tap_zendesk/schemas/sla_policies.json +128 -0
- mage_integrations/sources/zendesk/tap_zendesk/schemas/tags.json +20 -0
- mage_integrations/sources/zendesk/tap_zendesk/schemas/ticket_audits.json +789 -0
- mage_integrations/sources/zendesk/tap_zendesk/schemas/ticket_comments.json +72 -0
- mage_integrations/sources/zendesk/tap_zendesk/schemas/ticket_fields.json +199 -0
- mage_integrations/sources/zendesk/tap_zendesk/schemas/ticket_forms.json +113 -0
- mage_integrations/sources/zendesk/tap_zendesk/schemas/ticket_metrics.json +277 -0
- mage_integrations/sources/zendesk/tap_zendesk/schemas/tickets.json +393 -0
- mage_integrations/sources/zendesk/tap_zendesk/schemas/users.json +382 -0
- mage_integrations/sources/zendesk/tap_zendesk/streams.py +657 -0
- mage_integrations/sources/zendesk/tap_zendesk/sync.py +61 -0
- mage_integrations/sources/zendesk/templates/config.json +6 -0
- mage_integrations/sources/zendesk/test/__init__.py +0 -0
- mage_integrations/sources/zendesk/test/base.py +400 -0
- mage_integrations/sources/zendesk/test/test_all_fields.py +83 -0
- mage_integrations/sources/zendesk/test/test_all_streams.py +150 -0
- mage_integrations/sources/zendesk/test/test_automatic_fields.py +71 -0
- mage_integrations/sources/zendesk/test/test_bookmarks.py +160 -0
- mage_integrations/sources/zendesk/test/test_custom_fields_discover.py +43 -0
- mage_integrations/sources/zendesk/test/test_discovery.py +129 -0
- mage_integrations/sources/zendesk/test/test_minimal_selection.py +67 -0
- mage_integrations/sources/zendesk/test/test_pagination.py +74 -0
- mage_integrations/sources/zendesk/test/test_standard_bookmark.py +197 -0
- mage_integrations/sources/zendesk/test/test_start_date.py +165 -0
- mage_integrations/sources/zendesk/test/unittests/test_discovery_mode.py +308 -0
- mage_integrations/sources/zendesk/test/unittests/test_exception.py +55 -0
- mage_integrations/sources/zendesk/test/unittests/test_http.py +481 -0
- mage_integrations/sources/zendesk/test/unittests/test_init.py +23 -0
- mage_integrations/sources/zendesk/test/unittests/test_request_timeout.py +628 -0
- mage_integrations/sources/zendesk/test/unittests/test_tickets_child_stream_skip_404_error.py +82 -0
- mage_integrations/sources/zendesk/test/unittests/test_yield_records.py +193 -0
- mage_integrations/tests/__init__.py +0 -0
- mage_integrations/tests/connections/__init__.py +0 -0
- mage_integrations/tests/destinations/__init__.py +0 -0
- mage_integrations/tests/destinations/amplitude/__init__.py +0 -0
- mage_integrations/tests/destinations/amplitude/test_amplitude.py +117 -0
- mage_integrations/tests/destinations/bigquery/__init__.py +0 -0
- mage_integrations/tests/destinations/bigquery/test_bigquery.py +54 -0
- mage_integrations/tests/destinations/doris/__init__.py +0 -0
- mage_integrations/tests/destinations/doris/test_doris.py +64 -0
- mage_integrations/tests/destinations/mongodb/__init__.py +0 -0
- mage_integrations/tests/destinations/mongodb/test_mongodb.py +67 -0
- mage_integrations/tests/destinations/mssql/__init__.py +0 -0
- mage_integrations/tests/destinations/mssql/test_mssql.py +64 -0
- mage_integrations/tests/destinations/mysql/__init__.py +0 -0
- mage_integrations/tests/destinations/mysql/test_mysql.py +116 -0
- mage_integrations/tests/destinations/oracledb/__init__.py +0 -0
- mage_integrations/tests/destinations/oracledb/test_oracledb.py +63 -0
- mage_integrations/tests/destinations/postgresql/__init__.py +0 -0
- mage_integrations/tests/destinations/postgresql/test_postgres.py +60 -0
- mage_integrations/tests/destinations/redshift/__init__.py +0 -0
- mage_integrations/tests/destinations/redshift/test_redshift.py +68 -0
- mage_integrations/tests/destinations/search/__init__.py +0 -0
- mage_integrations/tests/destinations/search/test_sinks.py +71 -0
- mage_integrations/tests/destinations/snowflake/__init__.py +0 -0
- mage_integrations/tests/destinations/snowflake/test_snowflake.py +113 -0
- mage_integrations/tests/destinations/sql/__init__.py +0 -0
- mage_integrations/tests/destinations/sql/mixins.py +48 -0
- mage_integrations/tests/destinations/sql/test_truncate.py +94 -0
- mage_integrations/tests/destinations/test_base.py +557 -0
- mage_integrations/tests/sources/__init__.py +0 -0
- mage_integrations/tests/sources/amplitude/__init__.py +0 -0
- mage_integrations/tests/sources/amplitude/test_amplitude.py +232 -0
- mage_integrations/tests/sources/api/__init__.py +0 -0
- mage_integrations/tests/sources/api/test_api.py +377 -0
- mage_integrations/tests/sources/bigquery/__init__.py +0 -0
- mage_integrations/tests/sources/bigquery/test_bigquery.py +232 -0
- mage_integrations/tests/sources/couchbase/__init__.py +0 -0
- mage_integrations/tests/sources/couchbase/test_couchbase.py +379 -0
- mage_integrations/tests/sources/doris/__init__.py +0 -0
- mage_integrations/tests/sources/doris/test_doris.py +118 -0
- mage_integrations/tests/sources/mongodb/__init__.py +0 -0
- mage_integrations/tests/sources/mongodb/test_common.py +73 -0
- mage_integrations/tests/sources/mongodb/test_schema.py +91 -0
- mage_integrations/tests/sources/mysql/__init__.py +0 -0
- mage_integrations/tests/sources/mysql/test_mysql.py +114 -0
- mage_integrations/tests/sources/postgresql/__init__.py +0 -0
- mage_integrations/tests/sources/postgresql/test_postgresql.py +46 -0
- mage_integrations/tests/sources/sql/__init__.py +0 -0
- mage_integrations/tests/sources/sql/test_base.py +215 -0
- mage_integrations/tests/sources/test_base.py +404 -0
- mage_integrations/tests/test_dependency_contracts.py +28 -0
- mage_integrations/tests/utils/__init__.py +0 -0
- mage_integrations/tests/utils/test_frames.py +122 -0
- mage_integrations/transformers/__init__.py +0 -0
- mage_integrations/transformers/base.py +183 -0
- mage_integrations/transformers/utils.py +39 -0
- mage_integrations/utils/__init__.py +0 -0
- mage_integrations/utils/array.py +40 -0
- mage_integrations/utils/dates.py +45 -0
- mage_integrations/utils/dictionary.py +108 -0
- mage_integrations/utils/files.py +5 -0
- mage_integrations/utils/frames.py +123 -0
- mage_integrations/utils/logger/__init__.py +103 -0
- mage_integrations/utils/logger/constants.py +11 -0
- mage_integrations/utils/parsers.py +56 -0
- mage_integrations/utils/schema_helpers.py +37 -0
- mage_integrations/utils/strings.py +6 -0
- mage_integrations-0.2.1.dist-info/METADATA +304 -0
- mage_integrations-0.2.1.dist-info/RECORD +1016 -0
- mage_integrations-0.2.1.dist-info/WHEEL +5 -0
- mage_integrations-0.2.1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
from typing import List
|
|
2
|
+
|
|
3
|
+
from singer import catalog as catalog_singer
|
|
4
|
+
|
|
5
|
+
from mage_integrations.sources.base import Source, main
|
|
6
|
+
from mage_integrations.sources.catalog import Catalog
|
|
7
|
+
from mage_integrations.sources.sftp.tap_sftp.client import SFTPConnection
|
|
8
|
+
from mage_integrations.sources.sftp.tap_sftp.tap import do_discover, do_sync
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class SFTP(Source):
|
|
12
|
+
def discover(self, streams: List[str] = None) -> Catalog:
|
|
13
|
+
catalog = do_discover(self.config, self.logger)
|
|
14
|
+
|
|
15
|
+
catalog_entries = []
|
|
16
|
+
for stream in catalog['streams']:
|
|
17
|
+
stream_id = stream['tap_stream_id']
|
|
18
|
+
if not streams or stream_id in streams:
|
|
19
|
+
schema = catalog_singer.Schema.from_dict(stream['schema'])
|
|
20
|
+
catalog_entries.append(self.build_catalog_entry(stream_id,
|
|
21
|
+
schema))
|
|
22
|
+
|
|
23
|
+
return Catalog(catalog_entries)
|
|
24
|
+
|
|
25
|
+
def sync(self, catalog: Catalog) -> None:
|
|
26
|
+
do_sync(self.config, catalog, self.state or {}, self.logger)
|
|
27
|
+
|
|
28
|
+
def test_connection(self) -> None:
|
|
29
|
+
client = SFTPConnection(host=self.config['host'],
|
|
30
|
+
username=self.config['username'],
|
|
31
|
+
password=self.config['password'],
|
|
32
|
+
private_key_file=self.config.get(
|
|
33
|
+
'private_key_file'),
|
|
34
|
+
port=self.config['port'])
|
|
35
|
+
client.close()
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
if __name__ == '__main__':
|
|
39
|
+
main(SFTP)
|
|
File without changes
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import boto3
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class AWS_SSM:
|
|
5
|
+
|
|
6
|
+
_client = None
|
|
7
|
+
|
|
8
|
+
@classmethod
|
|
9
|
+
def _get_client(cls):
|
|
10
|
+
# returned the connection if it exists, else instantiate it
|
|
11
|
+
if cls._client:
|
|
12
|
+
return cls._client
|
|
13
|
+
else:
|
|
14
|
+
cls._client = boto3.client('ssm')
|
|
15
|
+
return cls._client
|
|
16
|
+
|
|
17
|
+
@classmethod
|
|
18
|
+
def get_decryption_key(cls, key_name):
|
|
19
|
+
client = cls._get_client()
|
|
20
|
+
response = client.get_parameter(
|
|
21
|
+
Name=key_name,
|
|
22
|
+
WithDecryption=True
|
|
23
|
+
)
|
|
24
|
+
return response.get('Parameter').get('Value')
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import re
|
|
3
|
+
import stat
|
|
4
|
+
import tempfile
|
|
5
|
+
import time
|
|
6
|
+
from datetime import datetime
|
|
7
|
+
|
|
8
|
+
import backoff
|
|
9
|
+
import paramiko
|
|
10
|
+
import pytz
|
|
11
|
+
import singer
|
|
12
|
+
from paramiko.ssh_exception import AuthenticationException, SSHException
|
|
13
|
+
|
|
14
|
+
from mage_integrations.sources.sftp.tap_sftp import decrypt
|
|
15
|
+
|
|
16
|
+
LOGGER = singer.get_logger()
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def handle_backoff(details):
|
|
20
|
+
LOGGER.warn(
|
|
21
|
+
"SSH Connection closed unexpectedly. Waiting {wait} seconds and \
|
|
22
|
+
retrying...".format(**details)
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class SFTPConnection():
|
|
27
|
+
def __init__(self,
|
|
28
|
+
host,
|
|
29
|
+
username,
|
|
30
|
+
password=None,
|
|
31
|
+
private_key_file=None,
|
|
32
|
+
port=None):
|
|
33
|
+
|
|
34
|
+
self.host = host
|
|
35
|
+
self.username = username
|
|
36
|
+
self.password = password
|
|
37
|
+
self.port = int(port or 22)
|
|
38
|
+
self.decrypted_file = None
|
|
39
|
+
self.key = None
|
|
40
|
+
self.transport = None
|
|
41
|
+
|
|
42
|
+
if private_key_file:
|
|
43
|
+
key_path = os.path.expanduser(private_key_file)
|
|
44
|
+
self.key = paramiko.RSAKey.from_private_key_file(key_path)
|
|
45
|
+
|
|
46
|
+
self.__connect()
|
|
47
|
+
|
|
48
|
+
# If connection is snapped during connect flow, retry up to a
|
|
49
|
+
# minute for SSH connection to succeed. 2^6 + 2^5 + ...
|
|
50
|
+
@backoff.on_exception(
|
|
51
|
+
backoff.expo,
|
|
52
|
+
(EOFError),
|
|
53
|
+
max_tries=6,
|
|
54
|
+
on_backoff=handle_backoff,
|
|
55
|
+
jitter=None,
|
|
56
|
+
factor=2)
|
|
57
|
+
def __connect(self):
|
|
58
|
+
try:
|
|
59
|
+
LOGGER.info('Creating new connection to SFTP...')
|
|
60
|
+
self.transport = paramiko.Transport((self.host, self.port))
|
|
61
|
+
self.transport.use_compression(True)
|
|
62
|
+
self.transport.connect(username=self.username,
|
|
63
|
+
password=self.password,
|
|
64
|
+
hostkey=None,
|
|
65
|
+
pkey=self.key)
|
|
66
|
+
self.__sftp = paramiko.SFTPClient.from_transport(self.transport)
|
|
67
|
+
LOGGER.info('Connection successful')
|
|
68
|
+
except (AuthenticationException, SSHException):
|
|
69
|
+
if self.transport:
|
|
70
|
+
self.transport.close()
|
|
71
|
+
self.transport = paramiko.Transport((self.host, self.port))
|
|
72
|
+
self.transport.use_compression(True)
|
|
73
|
+
self.transport.connect(username=self.username,
|
|
74
|
+
password=self.password,
|
|
75
|
+
hostkey=None,
|
|
76
|
+
pkey=None)
|
|
77
|
+
self.__sftp = paramiko.SFTPClient.from_transport(self.transport)
|
|
78
|
+
|
|
79
|
+
@property
|
|
80
|
+
def sftp(self):
|
|
81
|
+
# self.__connect()
|
|
82
|
+
return self.__sftp
|
|
83
|
+
|
|
84
|
+
@sftp.setter
|
|
85
|
+
def sftp(self, sftp):
|
|
86
|
+
self.__sftp = sftp
|
|
87
|
+
|
|
88
|
+
def close(self):
|
|
89
|
+
self.sftp.close()
|
|
90
|
+
if self.transport:
|
|
91
|
+
self.transport.close()
|
|
92
|
+
# decrypted files require an open file object, so close it
|
|
93
|
+
if self.decrypted_file:
|
|
94
|
+
self.decrypted_file.close()
|
|
95
|
+
|
|
96
|
+
def match_files_for_table(self, files, table_name, search_pattern):
|
|
97
|
+
LOGGER.info("Searching for files for table '%s',\
|
|
98
|
+
matching pattern: %s", table_name, search_pattern)
|
|
99
|
+
matcher = re.compile(search_pattern)
|
|
100
|
+
return [f for f in files if matcher.search(f["filepath"])]
|
|
101
|
+
|
|
102
|
+
def is_empty(self, file_attr):
|
|
103
|
+
return file_attr.st_size == 0
|
|
104
|
+
|
|
105
|
+
def is_directory(self, file_attr):
|
|
106
|
+
return stat.S_ISDIR(file_attr.st_mode)
|
|
107
|
+
|
|
108
|
+
def get_files_by_prefix(self, prefix):
|
|
109
|
+
"""
|
|
110
|
+
Accesses the underlying file system and gets all files
|
|
111
|
+
that match "prefix", in this case, a directory path.
|
|
112
|
+
|
|
113
|
+
Returns a list of filepaths from the root.
|
|
114
|
+
"""
|
|
115
|
+
files = []
|
|
116
|
+
|
|
117
|
+
if prefix is None or prefix == '':
|
|
118
|
+
prefix = '.'
|
|
119
|
+
|
|
120
|
+
try:
|
|
121
|
+
result = self.sftp.listdir_attr(prefix)
|
|
122
|
+
except FileNotFoundError as e:
|
|
123
|
+
raise Exception("Directory '{}' does not exist".format(prefix)) from e # noqa
|
|
124
|
+
|
|
125
|
+
for file_attr in result:
|
|
126
|
+
# NB: This only looks at the immediate level
|
|
127
|
+
# beneath the prefix directory
|
|
128
|
+
if self.is_directory(file_attr):
|
|
129
|
+
files += self.get_files_by_prefix(
|
|
130
|
+
prefix + '/' + file_attr.filename)
|
|
131
|
+
else:
|
|
132
|
+
if self.is_empty(file_attr):
|
|
133
|
+
continue
|
|
134
|
+
|
|
135
|
+
last_modified = file_attr.st_mtime
|
|
136
|
+
if last_modified is None:
|
|
137
|
+
LOGGER.warning("Cannot read m_time for file %s, \
|
|
138
|
+
defaulting to current epoch time",
|
|
139
|
+
os.path.join(prefix, file_attr.filename))
|
|
140
|
+
last_modified = time.time()
|
|
141
|
+
|
|
142
|
+
# NB: SFTP specifies path characters to be '/'
|
|
143
|
+
# https://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-6
|
|
144
|
+
files.append({"filepath": prefix + '/' + file_attr.filename,
|
|
145
|
+
"last_modified": datetime.utcfromtimestamp(last_modified).replace(tzinfo=pytz.UTC)}) # noqa
|
|
146
|
+
|
|
147
|
+
return files
|
|
148
|
+
|
|
149
|
+
def get_files(self, prefix, search_pattern, modified_since=None):
|
|
150
|
+
files = self.get_files_by_prefix(prefix)
|
|
151
|
+
if files:
|
|
152
|
+
LOGGER.info('Found %s files in "%s"', len(files), prefix)
|
|
153
|
+
else:
|
|
154
|
+
LOGGER.warning('Found no files on specified SFTP server at "%s"',
|
|
155
|
+
prefix)
|
|
156
|
+
|
|
157
|
+
matching_files = self.get_files_matching_pattern(files, search_pattern)
|
|
158
|
+
|
|
159
|
+
if matching_files:
|
|
160
|
+
LOGGER.info('Found %s files in "%s" \
|
|
161
|
+
matching "%s"', len(matching_files), prefix, search_pattern)
|
|
162
|
+
else:
|
|
163
|
+
LOGGER.warning('Found no files on specified SFTP server \
|
|
164
|
+
at "%s" matching "%s"', prefix, search_pattern)
|
|
165
|
+
|
|
166
|
+
for f in matching_files:
|
|
167
|
+
LOGGER.info("Found file: %s", f['filepath'])
|
|
168
|
+
|
|
169
|
+
if modified_since is not None:
|
|
170
|
+
matching_files = [f for f in matching_files if f["last_modified"] > modified_since] # noqa
|
|
171
|
+
|
|
172
|
+
return matching_files
|
|
173
|
+
|
|
174
|
+
def get_file_handle(self, f, decryption_configs=None):
|
|
175
|
+
""" Takes a file dict {"filepath": "...", "last_modified": "..."}
|
|
176
|
+
and returns a handle to the file. """
|
|
177
|
+
with tempfile.TemporaryDirectory() as tmpdirname:
|
|
178
|
+
sftp_file_path = f["filepath"]
|
|
179
|
+
local_path = f'{tmpdirname}/{os.path.basename(sftp_file_path)}'
|
|
180
|
+
if decryption_configs:
|
|
181
|
+
LOGGER.info(f'Decrypting file: {sftp_file_path}')
|
|
182
|
+
# Getting sftp file to local, then reading it is much faster
|
|
183
|
+
# than reading it directly from the SFTP
|
|
184
|
+
self.sftp.get(sftp_file_path, local_path)
|
|
185
|
+
decrypted_path = decrypt.gpg_decrypt(
|
|
186
|
+
local_path,
|
|
187
|
+
tmpdirname,
|
|
188
|
+
decryption_configs.get('key'),
|
|
189
|
+
decryption_configs.get('gnupghome'),
|
|
190
|
+
decryption_configs.get('passphrase')
|
|
191
|
+
)
|
|
192
|
+
LOGGER.info('Decrypting file complete')
|
|
193
|
+
try:
|
|
194
|
+
self.decrypted_file = open(decrypted_path, 'rb')
|
|
195
|
+
except FileNotFoundError:
|
|
196
|
+
raise Exception(f'Decryption of file failed: \
|
|
197
|
+
{sftp_file_path}')
|
|
198
|
+
return self.decrypted_file, decrypted_path
|
|
199
|
+
else:
|
|
200
|
+
self.sftp.get(sftp_file_path, local_path)
|
|
201
|
+
return open(local_path, 'rb')
|
|
202
|
+
|
|
203
|
+
def get_files_matching_pattern(self, files, pattern):
|
|
204
|
+
""" Takes a file dict {"filepath": "...", "last_modified": "..."} and
|
|
205
|
+
a regex pattern string, and returns
|
|
206
|
+
files matching that pattern. """
|
|
207
|
+
matcher = re.compile(pattern)
|
|
208
|
+
LOGGER.info(f"Searching for files for matching pattern: {pattern}")
|
|
209
|
+
return [f for f in files if matcher.search(f["filepath"])]
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
def connection(config):
|
|
213
|
+
return SFTPConnection(config['host'],
|
|
214
|
+
config['username'],
|
|
215
|
+
password=config.get('password'),
|
|
216
|
+
private_key_file=config.get('private_key_file'),
|
|
217
|
+
port=config.get('port'))
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import os
|
|
2
|
+
|
|
3
|
+
import gnupg
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def gpg_decrypt_to_file(gpg, src_file_path, decrypted_path, passphrase):
|
|
7
|
+
with open(src_file_path, 'rb') as file_obj:
|
|
8
|
+
gpg.decrypt_file(file_obj, output=decrypted_path, passphrase=passphrase)
|
|
9
|
+
return decrypted_path
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def initialize_gpg(key, gnupghome):
|
|
13
|
+
gpg = gnupg.GPG(gnupghome=gnupghome)
|
|
14
|
+
gpg.import_keys(key)
|
|
15
|
+
return gpg
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def gpg_decrypt(src_file_path, output_path, key, gnupghome, passphrase):
|
|
19
|
+
gpg_filename = os.path.basename(src_file_path)
|
|
20
|
+
decrypted_filename = os.path.splitext(gpg_filename)[0]
|
|
21
|
+
decrypted_path = f'{output_path}/{decrypted_filename}'
|
|
22
|
+
|
|
23
|
+
gpg = initialize_gpg(key, gnupghome)
|
|
24
|
+
return gpg_decrypt_to_file(gpg, src_file_path, decrypted_path, passphrase)
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import singer
|
|
2
|
+
from singer import metadata
|
|
3
|
+
|
|
4
|
+
from mage_integrations.sources.sftp.tap_sftp import client
|
|
5
|
+
from mage_integrations.sources.sftp.tap_sftp.singer_encodings import json_schema
|
|
6
|
+
|
|
7
|
+
LOGGER = singer.get_logger()
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def discover_streams(config):
|
|
11
|
+
streams = []
|
|
12
|
+
|
|
13
|
+
conn = client.connection(config)
|
|
14
|
+
|
|
15
|
+
tables = config.get('tables', [])
|
|
16
|
+
for table_spec in tables:
|
|
17
|
+
LOGGER.info('Sampling records to determine table JSON schema "%s".',
|
|
18
|
+
table_spec['table_name'])
|
|
19
|
+
schema = json_schema.get_schema_for_table(conn, table_spec, config)
|
|
20
|
+
stream_md = metadata.get_standard_metadata(schema,
|
|
21
|
+
key_properties=table_spec.get('key_properties', ['_sdc_source_file', '_sdc_source_lineno', '_sdc_source_last_modified']), # noqa
|
|
22
|
+
replication_method='INCREMENTAL')
|
|
23
|
+
streams.append(
|
|
24
|
+
{
|
|
25
|
+
'stream': table_spec['table_name'],
|
|
26
|
+
'tap_stream_id': table_spec['table_name'],
|
|
27
|
+
'schema': schema,
|
|
28
|
+
'metadata': stream_md
|
|
29
|
+
}
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
return streams
|
|
File without changes
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import gzip
|
|
2
|
+
import zipfile
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def infer(iterable, file_name):
|
|
6
|
+
"""Uses the incoming file_name and checks the end of the string
|
|
7
|
+
for supported compression types"""
|
|
8
|
+
if not file_name:
|
|
9
|
+
raise Exception("Need file name")
|
|
10
|
+
|
|
11
|
+
if file_name.endswith('.tar.gz'):
|
|
12
|
+
raise NotImplementedError("tar.gz not supported")
|
|
13
|
+
elif file_name.endswith('.gz'):
|
|
14
|
+
yield gzip.GzipFile(fileobj=iterable)
|
|
15
|
+
elif file_name.endswith('.zip'):
|
|
16
|
+
with zipfile.ZipFile(iterable) as zip:
|
|
17
|
+
for name in zip.namelist():
|
|
18
|
+
yield zip.open(name)
|
|
19
|
+
else:
|
|
20
|
+
yield iterable
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import csv
|
|
2
|
+
import io
|
|
3
|
+
import re
|
|
4
|
+
|
|
5
|
+
from mage_integrations.sources.sftp.tap_sftp.singer_encodings import compression
|
|
6
|
+
|
|
7
|
+
SDC_EXTRA_COLUMN = "_sdc_extra"
|
|
8
|
+
SDC_META_COLUMNS = ['_sdc_source_file', '_sdc_source_lineno', '_sdc_source_last_modified']
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def get_row_iterators(iterable, options={}, infer_compression=False):
|
|
12
|
+
"""Accepts an interable, options and a flag to infer compression and yields
|
|
13
|
+
csv.DictReader objects which can be used to yield CSV rows."""
|
|
14
|
+
if infer_compression:
|
|
15
|
+
compressed_iterables = compression.infer(iterable, options.get('file_name'))
|
|
16
|
+
for item in compressed_iterables:
|
|
17
|
+
yield get_row_iterator(item, options=options)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def sanitize_colname(col_name):
|
|
21
|
+
sanitized = re.sub(r'[^0-9a-zA-Z_]+', '_', col_name)
|
|
22
|
+
prefixed = re.sub(r'^(\d+)', r'x_\1', sanitized)
|
|
23
|
+
return prefixed.lower()
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def get_row_iterator(iterable, options=None):
|
|
27
|
+
"""Accepts an interable, options and returns a csv.DictReader object
|
|
28
|
+
which can be used to yield CSV rows."""
|
|
29
|
+
options = options or {}
|
|
30
|
+
|
|
31
|
+
for i in range(options.get('skip_rows', 0)):
|
|
32
|
+
iterable.__next__()
|
|
33
|
+
|
|
34
|
+
# Replace any NULL bytes in the line given to the DictReader
|
|
35
|
+
reader = csv.DictReader(
|
|
36
|
+
io.TextIOWrapper(iterable, encoding=options.get('encoding', 'utf-8')),
|
|
37
|
+
fieldnames=None,
|
|
38
|
+
restkey=SDC_EXTRA_COLUMN,
|
|
39
|
+
delimiter=options.get('delimiter', ',')
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
if 'sanitize_header' in options and options['sanitize_header']:
|
|
43
|
+
reader.fieldnames = [sanitize_colname(col) for col in reader.fieldnames].copy()
|
|
44
|
+
|
|
45
|
+
headers = set(reader.fieldnames + SDC_META_COLUMNS)
|
|
46
|
+
|
|
47
|
+
if options.get('key_properties'):
|
|
48
|
+
key_properties = set(options['key_properties'])
|
|
49
|
+
if not key_properties.issubset(headers):
|
|
50
|
+
raise Exception('CSV file missing required headers: {}'
|
|
51
|
+
.format(key_properties - headers))
|
|
52
|
+
|
|
53
|
+
if options.get('date_overrides'):
|
|
54
|
+
date_overrides = set(options['date_overrides'])
|
|
55
|
+
if not date_overrides.issubset(headers):
|
|
56
|
+
raise Exception('CSV file missing date_overrides headers: {}'
|
|
57
|
+
.format(date_overrides - headers))
|
|
58
|
+
return reader
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
|
|
2
|
+
from mage_integrations.sources.sftp.tap_sftp.aws_ssm import AWS_SSM
|
|
3
|
+
|
|
4
|
+
from . import csv_handler
|
|
5
|
+
|
|
6
|
+
SDC_SOURCE_FILE_COLUMN = "_sdc_source_file"
|
|
7
|
+
SDC_SOURCE_LINENO_COLUMN = "_sdc_source_lineno"
|
|
8
|
+
SDC_SOURCE_LAST_MODIFIED = "_sdc_source_last_modified"
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def get_schema_for_table(conn, table_spec, config):
|
|
12
|
+
files = conn.get_files(table_spec['search_prefix'], table_spec['search_pattern'])
|
|
13
|
+
|
|
14
|
+
if not files:
|
|
15
|
+
return {}
|
|
16
|
+
|
|
17
|
+
samples = sample_files(conn, table_spec, files, config)
|
|
18
|
+
|
|
19
|
+
data_schema = {
|
|
20
|
+
**generate_schema(samples, table_spec),
|
|
21
|
+
SDC_SOURCE_FILE_COLUMN: {'type': ['string']},
|
|
22
|
+
SDC_SOURCE_LINENO_COLUMN: {'type': ['integer']},
|
|
23
|
+
SDC_SOURCE_LAST_MODIFIED: {'type': ['string'], 'format': 'date-time'},
|
|
24
|
+
csv_handler.SDC_EXTRA_COLUMN: {'type': ['array'], 'items': {'type': 'string'}},
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return {
|
|
28
|
+
'type': 'object',
|
|
29
|
+
'properties': data_schema,
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def sample_file(conn, table_spec, f, sample_rate, max_records, config):
|
|
34
|
+
samples = []
|
|
35
|
+
decryption_configs = config.get('decryption_configs')
|
|
36
|
+
if decryption_configs:
|
|
37
|
+
decryption_configs['key'] = AWS_SSM.get_decryption_key(
|
|
38
|
+
decryption_configs.get('SSM_key_name'))
|
|
39
|
+
file_handle, decrypted_name = conn.get_file_handle(f,
|
|
40
|
+
decryption_configs)
|
|
41
|
+
f['filepath'] = decrypted_name
|
|
42
|
+
else:
|
|
43
|
+
file_handle = conn.get_file_handle(f)
|
|
44
|
+
|
|
45
|
+
# Add file_name to opts and flag infer_compression to support gzipped files
|
|
46
|
+
opts = {'key_properties': table_spec.get('key_properties',
|
|
47
|
+
['_sdc_source_file', '_sdc_source_lineno', '_sdc_source_last_modified']),
|
|
48
|
+
'delimiter': table_spec.get('delimiter', ','),
|
|
49
|
+
'file_name': f['filepath'],
|
|
50
|
+
'encoding': table_spec.get('encoding', 'utf-8'),
|
|
51
|
+
'sanitize_header': table_spec.get('sanitize_header', False),
|
|
52
|
+
'skip_rows': table_spec.get('skip_rows', 0)}
|
|
53
|
+
|
|
54
|
+
readers = csv_handler.get_row_iterators(file_handle, options=opts, infer_compression=True)
|
|
55
|
+
|
|
56
|
+
for reader in readers:
|
|
57
|
+
current_row = 0
|
|
58
|
+
for row in reader:
|
|
59
|
+
if (current_row % sample_rate) == 0:
|
|
60
|
+
if row.get(csv_handler.SDC_EXTRA_COLUMN):
|
|
61
|
+
row.pop(csv_handler.SDC_EXTRA_COLUMN)
|
|
62
|
+
samples.append(row)
|
|
63
|
+
|
|
64
|
+
current_row += 1
|
|
65
|
+
|
|
66
|
+
if len(samples) >= max_records:
|
|
67
|
+
break
|
|
68
|
+
|
|
69
|
+
# Empty sample to show field selection, if needed
|
|
70
|
+
empty_file = False
|
|
71
|
+
if len(samples) == 0:
|
|
72
|
+
empty_file = True
|
|
73
|
+
# Assumes all reader objects in readers have the same fieldnames
|
|
74
|
+
samples.append({name: None for name in reader.fieldnames})
|
|
75
|
+
|
|
76
|
+
return (empty_file, samples)
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def sample_files(conn, table_spec, files, config,
|
|
80
|
+
sample_rate=1, max_records=1000, max_files=1):
|
|
81
|
+
to_return = []
|
|
82
|
+
empty_samples = []
|
|
83
|
+
|
|
84
|
+
files_so_far = 0
|
|
85
|
+
|
|
86
|
+
sorted_files = sorted(files, key=lambda f: f['last_modified'], reverse=True)
|
|
87
|
+
|
|
88
|
+
for f in sorted_files:
|
|
89
|
+
empty_file, samples = sample_file(conn, table_spec, f,
|
|
90
|
+
sample_rate, max_records, config)
|
|
91
|
+
|
|
92
|
+
if empty_file:
|
|
93
|
+
empty_samples += samples
|
|
94
|
+
else:
|
|
95
|
+
to_return += samples
|
|
96
|
+
|
|
97
|
+
files_so_far += 1
|
|
98
|
+
|
|
99
|
+
if files_so_far >= max_files:
|
|
100
|
+
break
|
|
101
|
+
|
|
102
|
+
if not any(to_return):
|
|
103
|
+
return empty_samples
|
|
104
|
+
|
|
105
|
+
return to_return
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def infer(datum):
|
|
109
|
+
"""
|
|
110
|
+
Returns the inferred data type
|
|
111
|
+
"""
|
|
112
|
+
if datum is None or datum == '':
|
|
113
|
+
return None
|
|
114
|
+
|
|
115
|
+
try:
|
|
116
|
+
int(datum)
|
|
117
|
+
return 'integer'
|
|
118
|
+
except (ValueError, TypeError):
|
|
119
|
+
pass
|
|
120
|
+
|
|
121
|
+
try:
|
|
122
|
+
# numbers are NOT floats, they are DECIMALS
|
|
123
|
+
float(datum)
|
|
124
|
+
return 'number'
|
|
125
|
+
except (ValueError, TypeError):
|
|
126
|
+
pass
|
|
127
|
+
|
|
128
|
+
return 'string'
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
def count_sample(sample, type_summary, table_spec):
|
|
132
|
+
"""
|
|
133
|
+
Generates a summary dict of each column and its inferred types
|
|
134
|
+
|
|
135
|
+
{'Column1': {'string': 10}, 'Column2': {'integer': 10}}
|
|
136
|
+
"""
|
|
137
|
+
for key, value in sample.items():
|
|
138
|
+
if key not in type_summary:
|
|
139
|
+
type_summary[key] = {}
|
|
140
|
+
|
|
141
|
+
date_overrides = table_spec.get('date_overrides', [])
|
|
142
|
+
if key in date_overrides:
|
|
143
|
+
datatype = "date-time"
|
|
144
|
+
else:
|
|
145
|
+
datatype = infer(value)
|
|
146
|
+
|
|
147
|
+
if datatype is not None:
|
|
148
|
+
type_summary[key][datatype] = type_summary[key].get(datatype, 0) + 1
|
|
149
|
+
|
|
150
|
+
return type_summary
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
def pick_datatype(type_count):
|
|
154
|
+
"""
|
|
155
|
+
If the underlying records are ONLY of type `integer`, `number`,
|
|
156
|
+
or `date-time`, then return that datatype.
|
|
157
|
+
|
|
158
|
+
If the underlying records are of type `integer` and `number` only,
|
|
159
|
+
return `number`.
|
|
160
|
+
|
|
161
|
+
Otherwise return `string`.
|
|
162
|
+
"""
|
|
163
|
+
to_return = 'string'
|
|
164
|
+
|
|
165
|
+
if type_count.get('date-time', 0) > 0:
|
|
166
|
+
return 'date-time'
|
|
167
|
+
|
|
168
|
+
if len(type_count) == 1:
|
|
169
|
+
if type_count.get('integer', 0) > 0:
|
|
170
|
+
to_return = 'integer'
|
|
171
|
+
elif type_count.get('number', 0) > 0:
|
|
172
|
+
to_return = 'number'
|
|
173
|
+
|
|
174
|
+
elif (len(type_count) == 2 and type_count.get('integer', 0) > 0 and type_count.get('number', 0) > 0): # noqa
|
|
175
|
+
to_return = 'number'
|
|
176
|
+
|
|
177
|
+
return to_return
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
def generate_schema(samples, table_spec):
|
|
181
|
+
type_summary = {}
|
|
182
|
+
for sample in samples:
|
|
183
|
+
type_summary = count_sample(sample, type_summary, table_spec)
|
|
184
|
+
|
|
185
|
+
schema = {}
|
|
186
|
+
for key, value in type_summary.items():
|
|
187
|
+
datatype = pick_datatype(value)
|
|
188
|
+
|
|
189
|
+
if datatype == 'date-time':
|
|
190
|
+
schema[key] = {
|
|
191
|
+
'anyOf': [
|
|
192
|
+
{'type': ['null', 'string'], 'format': 'date-time'},
|
|
193
|
+
{'type': ['null', 'string']}
|
|
194
|
+
]
|
|
195
|
+
}
|
|
196
|
+
else:
|
|
197
|
+
types = ['null', datatype]
|
|
198
|
+
if datatype != 'string':
|
|
199
|
+
types.append('string')
|
|
200
|
+
schema[key] = {
|
|
201
|
+
'type': types,
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
return schema
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
STATS = {}
|
|
2
|
+
|
|
3
|
+
# example = {
|
|
4
|
+
# '<table_name>': {
|
|
5
|
+
# 'search_prefix': 'folder1',
|
|
6
|
+
# 'search_pattern': 'file.*.csv'
|
|
7
|
+
# 'files': {
|
|
8
|
+
# '<filepath>': {
|
|
9
|
+
# 'row_count': 100,
|
|
10
|
+
# 'last_modified': '10-03-2018T5:00:00'
|
|
11
|
+
# },
|
|
12
|
+
# 'folder1/file_1.csv': {
|
|
13
|
+
# 'row_count': 50,
|
|
14
|
+
# 'last_modified': '10-04-2018T8:00:00'
|
|
15
|
+
# }
|
|
16
|
+
# }
|
|
17
|
+
# }
|
|
18
|
+
# }
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def add_file_data(table_spec, filepath, last_modified, row_count):
|
|
22
|
+
table_name = table_spec['table_name']
|
|
23
|
+
global STATS
|
|
24
|
+
if STATS.get(table_name):
|
|
25
|
+
STATS[table_name]['files'][filepath] = {
|
|
26
|
+
'last_modified': last_modified,
|
|
27
|
+
'row_count': row_count
|
|
28
|
+
}
|
|
29
|
+
else:
|
|
30
|
+
initialize_table_stats(table_spec)
|
|
31
|
+
|
|
32
|
+
STATS[table_name]['files'][filepath] = {
|
|
33
|
+
'last_modified': last_modified,
|
|
34
|
+
'row_count': row_count
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def initialize_table_stats(table_spec):
|
|
39
|
+
global STATS
|
|
40
|
+
STATS[table_spec['table_name']] = {
|
|
41
|
+
'search_prefix': table_spec['search_prefix'],
|
|
42
|
+
'search_pattern': table_spec['search_pattern'],
|
|
43
|
+
'files': {}
|
|
44
|
+
}
|