text
stringlengths
92
5.09M
from concurrent.futures import ThreadPoolExecutor from datetime import datetime, timezone import os from pathlib import Path import json import re import time from typing import Any import unittest import random import string import sys import logging import boto3 from botocore.exceptions import ClientError import pan...
import pytest def pytest_addoption(parser): parser.addoption( "--run-slow", action="store_true", default=False, help="Run slow tests" ) def pytest_configure(config): config.addinivalue_line("markers", "slow: mark test as slow to run") def pytest_collection_modifyitems(config, items): if co...
import json import os import boto3 from botocore.exceptions import ClientError import time def lambda_handler(event, context): """ Lambda function to process the request and ingest records into Timestream. The function accepts a list of records, handles MULTI measure types, and sends data in batches to...
from boto3 import session from botocore.exceptions import ClientError import json import time import requests # The maximum total number of seconds to wait for a Grafana resource to finish creating. MAX_WAIT_SECONDS = 900 # 15 minutes # The number of seconds to wait before checking whether a Grafana resource has finis...
from boto3 import session from botocore.auth import SigV4Auth from botocore.awsrequest import AWSRequest from http import HTTPStatus from requests.exceptions import HTTPError import json import os import requests import time import zipfile MAX_WAIT_SECONDS = 900 # 15 minutes def create_lambda(session: session, lambda...
import pytest import random from datetime import datetime, timedelta import sys sys.path.append('../../') from sample_data_generator.data_generator import * @pytest.fixture def config_factory(): def _factory(data_generator_type, **kwargs): random.seed(42) # Set a fixed seed for reproducibility ge...
import math import random import great_circle_calculator.great_circle_calculator as gcc from datetime import datetime, timedelta from haversine import haversine, Unit from .data_generator import DataGenerator, Direction class FlightDataGenerator(DataGenerator): def __init__(self): self.airports = [ ...
from .data_generator import DataGenerator class StockMarketDataGenerator(DataGenerator): def __init__(self): self.measure_templates = [ { "name": "volume", "type": "BIGINT", "max_variation": 30000, "max": 100000000, ...
from .data_generator import DataGenerator class GamingDataGenerator(DataGenerator): def __init__(self): self.measure_templates = [ { "name": "X", "type": "DOUBLE", "max_variation": 2.1, "max": 5000.0, "min": -5000.0...
from .data_generator import DataGenerator class PatientDataGenerator(DataGenerator): def __init__(self): self.measure_templates = [ { "name": "heart_rate_bpm", "type": "BIGINT", "max_variation": 5.0, "max": 100, "mi...
from .data_generator import DataGenerator class EnergyDataGenerator(DataGenerator): def __init__(self): self.measure_templates = [ { "name": "energy_usage_kWh", "type": "BIGINT", "max_variation": 50, "max": 300, "mi...
from .data_generator import DataGenerator class ExchangeRateDataGenerator(DataGenerator): def __init__(self): self.measure_templates = [ { "name": "exchange_rate", "type": "DOUBLE", "max_variation": 1.0, "max": 90.0, ...
from .data_generator import DataGenerator class DevOpsDataGenerator(DataGenerator): def __init__(self): self.measure_templates = [ { "name": "cpu_usage", "type": "DOUBLE", "max_variation": 1.2, "max": 100.0, "min": ...
from .data_generator import DataGenerator class WeatherDataGenerator(DataGenerator): def __init__(self): self.measure_templates = [ { "name": "temperature_celsius", "type": "DOUBLE", "max_variation": 1.5, "max": 65.0, ...
from .air_quality_data_generator import AirQualityDataGenerator from .custom_data_generator import CustomDataGenerator from .data_generator import DataGenerator, Direction from .devops_data_generator import DevOpsDataGenerator from .energy_data_generator import EnergyDataGenerator from .exchange_rate_data_generator imp...
from .data_generator import DataGenerator class AirQualityDataGenerator(DataGenerator): def __init__(self): self.measure_templates = [ { "name": "PM2.5", "type": "DOUBLE", "max_variation": 1.0, "max": 150.0, "min": ...
import random from datetime import datetime, timedelta from enum import Enum class Direction(Enum): UP = "UP" DOWN = "DOWN" BIDIRECTIONAL = "BIDIRECTIONAL" class DataGenerator: def __init__(self, measure_templates: list, dimension_templates: list): """ :param measure_templates: list: A...
from .data_generator import DataGenerator class IoTDataGenerator(DataGenerator): def __init__(self): self.measure_templates = [ { "name": "temperature_celsius", "type": "DOUBLE", "max_variation": 0.5, "max": 60, "mi...
import boto3 import json import os from pathlib import Path import tarfile def get_secret(secret_name: str, region_name: str | None = None) -> dict[str, str]: """ Retrieves a secret value from a secret in AWS Secrets Manager. Args: secret_name (str): The name of the secret to retrieve. re...
from typing import Any import pytest from datetime import datetime, timezone import json import os import re import time import unittest import random import string import sys import tempfile import logging import boto3 import httpx from influxdb_client.client.organizations_api import OrganizationsApi from influxdb_cl...
from typing import Any import pytest import json import os import re import time import unittest import random import string import sys import tempfile import logging import boto3 from influxdb_client.client.organizations_api import OrganizationsApi from influxdb_client.client.influxdb_client import InfluxDBClient fro...
#!/usr/bin/env python3 """ Script for migrating InfluxDB v2 bucket data to InfluxDB v3. """ import argparse from concurrent.futures import ProcessPoolExecutor, as_completed from datetime import datetime from pathlib import Path import shutil import os import subprocess import logging import sys from influxdb_client.cl...
""" Script that ingests line protocol files to InfluxDB v3 in parallel. """ from concurrent.futures import ProcessPoolExecutor, as_completed from io import TextIOWrapper from multiprocessing import current_process import os import sys import argparse import time import logging import random import requests from pathli...
import random import time import boto3 import datetime import glob import numpy as np import pandas as pd data_frame = None # from multiprocessing.sharedctypes import Value, Array from multiprocessing import Process, Lock from botocore.config import Config epoch = datetime.datetime.utcfromtimestamp(0) def unix_ti...
import os import unittest import random import string import sys import tempfile import time import logging from influxdb_client.client.influxdb_client import InfluxDBClient from testcontainers.influxdb2 import InfluxDb2Container sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../../"))) ...
import os import unittest import shutil import sys import logging import pandas from pandas import Timedelta import pytest from influxdb_client.client.influxdb_client import InfluxDBClient from testcontainers.influxdb2 import InfluxDb2Container sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__)...
from contextlib import redirect_stdout import io import os import time import unittest import random import re import string import sys import logging from boto3 import Session from botocore.client import BaseClient from botocore.exceptions import ClientError import pandas from pandas import Timedelta sys.path.inser...
import random import boto3 import botocore import json import time import os import sys sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../../"))) from unload.utils.logger_utils import create_logger class S3Utility: def __init__(self, region=None, log_file=None): botocore_con...
import logging import os def create_logger(logger_name, log_file=None, log_level=logging.INFO): """ Create a logger that can log to both console and file. Args: logger_name (str): Name of the logger log_file (str, optional): Path to log file. If None, logs only to console log_...
import boto3 from botocore.exceptions import ClientError import botocore from datetime import datetime, timedelta from dateutil.relativedelta import relativedelta import time import json import re import os import sys sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../../"))) from unload.u...
import boto3 import time import re import os import sys sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../../"))) from unload.utils.logger_utils import create_logger # 24 hours MAX_WAIT_SECONDS = 86400 class AthenaUtility: def __init__(self, region=None): """ Initi...
#!/usr/bin/python import argparse import boto3 from datetime import datetime, timezone import sys import os sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) from unload.utils.logger_utils import create_logger from unload.utils.timestream_utils import TimestreamUtility from unload.ut...
import os import time import boto3 import psycopg2 import glob import queue from datetime import datetime import argparse import sys import json import logging import shutil import re import concurrent.futures from psycopg2 import pool import gzip sys.path.append("../../unload/utils/") from logger_utils import create...
""" Live Migration Dashboard ======================== Streamlit application to monitor the migration of data from Amazon Timestream for LiveAnalytics to InfluxDB. The UI surfaces key configuration values, overall progress metrics, detailed batch statistics, and raw log output—all sourced from logs written by the migrat...
#!/usr/bin/env python3 """ A simple application providing a basic example of how to use Timestream for LiveAnalytics APIs. This application reads a sample JSON dataset and creates Timestream records to ingest into Timestream for LiveAnalytics. """ import boto3 from botocore.config import Config import json from dateti...
#!/usr/bin/env python3 """ A simple application providing a basic example of how to use the InfluxDB APIs. This application reads a sample JSON dataset and creates InfluxDB line protocol points to ingest into InfluxDB. """ from datetime import datetime import json import os import sys from typing import Dict, List, An...
""" Compare row/point counts between an Amazon Athena (or Timestream) table and an InfluxDB bucket measurement, optionally within a specific time-range. Example CLI usage: python validate.py \ --source-engine timestream \ --timestream-db benchmark3 \ --timestream-table cpu \ --infl...
""" Parallel processing of ingesting gzip line protocol files to InfluxDB. This module extracts and ingests gzip files using multiple processes. """ import os import sys import gzip import shutil import argparse import time import logging import random import multiprocessing from multiprocessing import Pool, current_p...
import argparse from dataclasses import dataclass import logging import time import os import sys import pyarrow.parquet as pq import pyarrow.fs as fs sys.path.insert( 0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../../../")) ) from unload.utils.timestream_utils import TimestreamUtility from unload...
import csv import sys import argparse import shutil import os import yaml import logging import time from boto3 import Session from datetime import datetime, timezone, timedelta from influxdb_client import InfluxDBClient from concurrent.futures import ThreadPoolExecutor sys.path.insert(0, os.path.abspath(os.path.join(...
import argparse from datetime import datetime import os import sys sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) from unload.utils.timestream_utils import TimestreamUtility from unload.utils.logger_utils import create_logger cardinality_logger = create_logger("cardinality") de...
from collections import defaultdict, namedtuple import random, string import os import math import json import time import sys, traceback from timeit import default_timer as timer import numpy as np import datetime import threading import argparse from pathlib import Path import signal from botocore.config import Confi...
import json import boto3 from backoff import expo import argparse from utils.s3_utils import * from utils.timestream_utils import * from utils.logger_utils import create_logger import sys if __name__ == '__main__': parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter) #pars...
import boto3 from utils.logger_utils import create_logger import botocore import boto3.s3.transfer as s3transfer import tqdm import os class s3Utility: def __init__(self, region, multi_part_upload_chunk): botocore_config = botocore.config.Config( max_pool_connections=5000, retries={'max_attemp...
import logging def create_logger(logger_name, log_level=logging.INFO): # Create logger logger = logging.getLogger(logger_name) logger.setLevel(log_level) # Create console handler and set level ch = logging.StreamHandler() ch.setLevel(log_level) # Create formatter and add it to the handle...
import boto3 import backoff from utils.logger_utils import create_logger import threading import queue import botocore class timestreamUtility: def __init__(self, region, database, table, sns_topic_arn): botocore_config = botocore.config.Config( max_pool_connections=5000, retries={'max_attempt...
#!/usr/bin/python import argparse import boto3 import json from botocore.config import Config from utils.logger_utils import create_logger from utils.s3_utils import s3Utility def main(logger, region, database, table, bucket_s3_uri, from_time, end_time, partition, iam_role_arn): session = boto3.Session() if ...
import logging import os from parameterized import parameterized from sys import platform import unittest from unittest import mock import influx_migration src_bucket = "test-bucket" dest_bucket = "dest-bucket" test_dir_name = "test-dir" org = "org" host = "http://some_address.com:8086" class BaseTestCases: cla...
from datetime import datetime import glob import os import shutil import time import unittest import influx_migration from influxdb_client import InfluxDBClient, Point, WritePrecision from influxdb_client.client.util.date_utils_pandas import PandasDateTimeHelper import influxdb_client.client.util.date_utils as date_ut...
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with # the License. A copy of the License is located at # # http://www.apache.org/licenses/LICENSE-2.0 # # or in the "license" file acco...
#!/usr/bin/env bash # # The MIT License # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, ...
#!/usr/bin/env bash # # The MIT License # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, ...
################################################## ## A helper to summarize the statistics from a ## ## concurrent run for the query workload. ######## ################################################## import argparse import pprint import glob import os import csv import numpy as np if __name__ == "__main__": ...
################################################## ## A multi-process and multi-threaded driver ##### ## that ingests data mimicking a DevOps ########## ## application into the specified Timestream ##### ## database and table. It also creates the ####### ## database and table it they don't exist. ####### ##############...
import boto3 import json from botocore.config import Config import time import sys, traceback import pprint ''' ## Create a timestream write client. ''' def createWriteClient(region, profile = None, credStr = None, endpoint = None): if profile == None and credStr == None: print("Using credentials from the ...
import numpy as np from scipy.stats import gmean from collections import namedtuple import threading import multiprocessing import configparser import timestreamquery as tsquery import os from timeit import default_timer as timer from query_execution_utils import executeQueryInstance, Query import sys, traceback import...
from collections import namedtuple import threading import multiprocessing import time from tdigest import TDigest import timestreamwrite as tswrite import model import datetime from timeit import default_timer as timer import json import sys, traceback import random import math import signal def getTimestampMillis():...
import boto3 import json from botocore.config import Config import time import random import sys, traceback from timeit import default_timer as timer import numpy as np import datetime import pandas as pd import os import argparse from collections import defaultdict, namedtuple ########################################...
################################################## ## A helper to clean up the Timestream database ## ## and table used for the performance run ######## ################################################## import timestreamwrite as tswrite import argparse import pprint if __name__ == "__main__": parser = argparse....
################################################## ## A multi-process and multi-threaded driver ##### ## that executes the specified query workload #### ## simulating concurrent user sessions querying ## ## recent and historical data ingested into ###### ## the specified database and table in Timestream ###############...
from collections import namedtuple import random, string import numpy as np import uuid ###################################################################################### ## Data model for an example DevOps application tracking resource utilization stats ## ## for hosts deployed in a service. The service is deploy...
import boto3 import json import time import random import sys, traceback from timeit import default_timer as timer import numpy as np from scipy.stats import gmean import datetime import os from collections import defaultdict, namedtuple import timestreamquery as timestream import pandas as pd Query = namedtuple('Quer...
package com.amazonaws.sample.csv.mapping; import lombok.Data; import lombok.RequiredArgsConstructor; import lombok.ToString; // TODO: adjust model to your CSV file @RequiredArgsConstructor @ToString @Data public class SampleCsvRow { private final String region; private final String az; private final Strin...
package com.amazonaws.sample.csv.mapping; import com.google.common.collect.Lists; import lombok.SneakyThrows; import software.amazon.awssdk.services.timestreamwrite.model.Dimension; import software.amazon.awssdk.services.timestreamwrite.model.Record; import software.amazon.awssdk.services.timestreamwrite.model.TimeUni...
package com.amazonaws.sample.csv.ingestion; import com.amazonaws.sample.timestream.multithreaded.TimestreamWriter; import com.amazonaws.sample.timestream.multithreaded.TimestreamWriterConfig; import com.amazonaws.sample.timestream.multithreaded.TimestreamWriterImpl; import com.amazonaws.sample.timestream.multithreaded...
package com.amazonaws.sample.csv.ingestion; import com.amazonaws.sample.csv.mapping.SampleCsvMapper; import com.amazonaws.sample.csv.mapping.SampleCsvRow; import com.amazonaws.sample.timestream.multithreaded.TimestreamWriter; import lombok.NonNull; import org.simpleflatmapper.csv.CsvParser; import org.slf4j.Logger; im...
#!/bin/bash set -eo pipefail orig_dir="$PWD" cd ./../../ mvn package cd $orig_dir ARTIFACT_BUCKET=$(cat test-run-bucket-name.txt) aws cloudformation package --template-file cloudformation-lambda.yaml --s3-bucket $ARTIFACT_BUCKET --output-template-file out-cloudformation-lambda.yml aws cloudformation deploy --templat...
package com.amazonaws.sample.lambda; import lombok.Getter; import lombok.Setter; import lombok.var; public class EnvVariablesHelper { @Getter @Setter private static int TimestreamWriterThreadPoolSize = getIntEnvVariable( "TIMESTREAM_WRITER_THREAD_POOL_SIZE", 1024); @Getter @Setter ...
package com.amazonaws.sample.lambda; import com.amazonaws.sample.timestream.multithreaded.TimestreamWriter; import com.amazonaws.sample.timestream.multithreaded.TimestreamWriterConfig; import com.amazonaws.sample.timestream.multithreaded.TimestreamWriterImpl; import com.amazonaws.sample.timestream.multithreaded.util.L...
package com.amazonaws.sample.lambda; import com.google.common.base.Preconditions; import lombok.Getter; import lombok.RequiredArgsConstructor; import lombok.ToString; import lombok.var; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.Map; @ToString @RequiredArgsConstructor @Getter public cl...
package com.amazonaws.sample.lambda; import com.amazonaws.sample.csv.ingestion.SampleCsvIngestion; import com.amazonaws.services.lambda.runtime.Context; import com.amazonaws.services.lambda.runtime.RequestHandler; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import software.amazon.awssdk.core.ResponseInput...
package com.amazonaws.sample.lambda; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import java.util.Map; class HandlerTest { @Test @Disabled("Only for local debugging.") void testExecution() { EnvVariablesHelper.setTimestreamWri...
package com.amazonaws.sample.timestream.multithreaded; import com.amazonaws.sample.timestream.multithreaded.metrics.TimestreamInsertionMetrics; import com.amazonaws.sample.timestream.multithreaded.metrics.TimestreamWriterMetrics; import com.amazonaws.sample.timestream.multithreaded.util.TimestreamInitializer; import c...
package com.amazonaws.sample.timestream.multithreaded; import com.amazonaws.sample.timestream.multithreaded.metrics.TimestreamInsertionMetrics; import com.amazonaws.sample.timestream.multithreaded.util.TimestreamInitializer; import lombok.NonNull; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import softwar...
package com.amazonaws.sample.timestream.multithreaded.util; import com.amazonaws.sample.timestream.multithreaded.metrics.TimestreamInsertionMetrics; import com.amazonaws.sample.timestream.multithreaded.metrics.TimestreamWriterMetrics; import com.amazonaws.sample.timestream.multithreaded.TimestreamWriter; import lombok...
package com.amazonaws.sample.timestream.multithreaded.util; import com.amazonaws.sample.timestream.multithreaded.TimestreamWriterConfig; import lombok.NonNull; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import software.amazon.awssdk.services.timestreamwrite.TimestreamWriteClient; import software.amazon....
package com.amazonaws.sample.timestream.multithreaded; import com.amazonaws.sample.timestream.multithreaded.metrics.TimestreamWriterMetrics; import software.amazon.awssdk.services.timestreamwrite.model.WriteRecordsRequest; // See README.md for interface description. public interface TimestreamWriter { boolean put...
package com.amazonaws.sample.timestream.multithreaded.metrics; import lombok.AccessLevel; import lombok.Getter; import lombok.NonNull; import java.util.LinkedHashMap; import java.util.Map; import java.util.concurrent.atomic.AtomicLong; @Getter public class TimestreamInsertionMetrics { // records ingested success...
package com.amazonaws.sample.timestream.multithreaded.metrics; import lombok.Getter; import lombok.RequiredArgsConstructor; @RequiredArgsConstructor public class TimestreamWriterMetrics { @Getter private final TimestreamInsertionMetrics insertionMetrics; private final int queueSize; private final int ...
package com.amazonaws.sample.timestream.multithreaded; import com.google.common.base.Preconditions; import lombok.*; import software.amazon.awssdk.core.client.config.ClientOverrideConfiguration; import software.amazon.awssdk.core.retry.RetryPolicy; import software.amazon.awssdk.http.apache.ApacheHttpClient; import sof...
import fs from 'fs'; import readline from 'readline'; import { constants } from "./constants.js"; import { WriteRecordsCommand } from "@aws-sdk/client-timestream-write"; export async function processCSV(writeClient, filePath) { try { await ingestCsvRecords(writeClient, filePath); } catch (e) { ...
import { S3Client, CreateBucketCommand, DeleteBucketCommand, ListObjectsCommand, DeleteObjectsCommand, GetObjectCommand } from "@aws-sdk/client-s3"; import { STSClient, GetCallerIdentityCommand } from "@aws-sdk/client-sts"; import zlib from 'zlib'; import { Readable } from 'stream'; import c...
import {constants} from "../constants.js"; import {QueryCommand} from "@aws-sdk/client-timestream-query"; export class UnloadUtils { constructor(queryClient, timestreamDependencyHelper, exported_bucket_name) { this.queryClient = queryClient; this.timestreamDependencyHelper = timestreamDependencyHel...
// Constants export const constants = { DATABASE_NAME: 'testNodeJsDB', TABLE_NAME: 'testNodeJsTable', HT_TTL_HOURS: 24, CT_TTL_DAYS: 7, S3_BUCKET_PREFIX_UNLOAD: "timestream-sample-", PARTITION_KEY_DIMENSION_TABLE_NAME: "host_metrics_dim_pk", PARTITION_KEY_MEASURE_TABLE_NAME: "host_metrics_me...
import fs from 'fs'; import readline from 'readline'; import {WriteRecordsCommand} from "@aws-sdk/client-timestream-write"; import {constants} from "./constants.js"; import {UnloadUtils} from "./utils/unload-utils.js"; export class UnloadExample { constructor(writeClient, queryClient, timestreamDependencyHelper, c...
import { constants } from "./constants.js"; import { CreateDatabaseCommand, CreateTableCommand, DeleteDatabaseCommand, DeleteTableCommand, DescribeDatabaseCommand, DescribeTableCommand, ListDatabasesCommand, ListTablesCommand, UpdateDatabaseCommand, UpdateTableCommand, WriteRecordsCommand } from "@aws-s...
import { constants } from "./constants.js"; import { getAllRows } from "./query-example.js"; import { printRejectedRecordsException } from "./crud-and-simple-ingestion-example.js"; import { CreateTableCommand, DescribeTableCommand, UpdateTableCommand, WriteRecordsCommand } from "@aws-sdk/client-timestream-write"; // ...
import { constants } from "./constants.js"; import {CancelQueryCommand, QueryCommand} from "@aws-sdk/client-timestream-query"; const HOSTNAME = "host-24Gju"; // See records ingested into this table so far const SELECT_ALL_QUERY = "SELECT * FROM " + constants.DATABASE_NAME + "." + constants.TABLE_NAME; //1. Find t...
import { TimestreamWriteClient } from "@aws-sdk/client-timestream-write"; import { TimestreamQueryClient } from "@aws-sdk/client-timestream-query"; import { TimestreamDependencyHelper } from "./utils/timestream-dependency-helper.js"; import * as crudAndSimpleIngestionExample from "./crud-and-simple-ingestion-example.js...
#!/usr/bin/python import csv import Constant from utils.UnloadUtil import UnloadUtil from utils.WriteUtil import WriteUtil from utils.TimestreamDependencyHelper import TimestreamDependencyHelper class UnloadExample: def __init__(self, region, write_client, query_client): self.region = region sel...
import boto3 import json class TimestreamDependencyHelper: def __init__(self, region): self.region = region self.s3_client = boto3.client('s3', region_name=region) self.s3_resource = boto3.resource('s3') self.sts_client = boto3.client("sts") def get_account(self): ret...
import json import pandas as pd import sys import traceback class UnloadUtil: def __init__(self, client, timestream_dependency_helper, database_name, table_name, exported_bucket_name): self.client = client self.timestream_dependency_helper = timestream_dependency_helper #Exporting the data...
#!/usr/bin/python import time from Constant import HT_TTL_HOURS, CT_TTL_DAYS class WriteUtil: def __init__(self, client): self.client = client def create_database(self, database_name): print("Creating Database") try: self.client.create_database(DatabaseName=database_name)...
#!/usr/bin/python import sys import boto3 import argparse from enum import Enum from botocore.config import Config from utils.WriteUtil import WriteUtil from UnloadExample import UnloadExample from BasicExample import BasicExample from CompositePartitionKeyExample import CompositePartitionKeyExample from Constant imp...
from Constant import DATABASE_NAME, TABLE_NAME from utils.WriteUtil import WriteUtil from CrudAndSimpleIngestionExample import CrudAndSimpleIngestionExample from CsvIngestionExample import CsvIngestionExample from QueryExample import QueryExample class BasicExample: def __init__(self, write_client, query_client, km...
import random import string from Constant import DATABASE_NAME from Constant import HT_TTL_HOURS from Constant import CT_TTL_DAYS from utils.WriteUtil import WriteUtil from CrudAndSimpleIngestionExample import CrudAndSimpleIngestionExample from QueryExample import QueryExample from utils.TimestreamDependencyHelper impo...
import Constant import time from utils.WriteUtil import WriteUtil from Constant import * class CrudAndSimpleIngestionExample: def __init__(self, client): self.client = client self.write_util = WriteUtil(client) def write_records(self): print("Writing records") current_time = s...
#!/usr/bin/python from Constant import DATABASE_NAME, TABLE_NAME class QueryExample: HOSTNAME = "host-24Gju" def __init__(self, client): self.client = client self.paginator = client.get_paginator('query') # See records ingested into this table so far SELECT_ALL = "SELECT * FROM " + D...
#!/usr/bin/python import csv import time from Constant import DATABASE_NAME, TABLE_NAME class CsvIngestionExample: def __init__(self, client): self.client = client def bulk_write_records(self, filepath): with open(filepath, 'r') as csvfile: # creating a csv reader object ...
#!/bin/bash set -u # Treat unset variables as an error : "${INFLUXDB_V2_URL:?Environment variable INFLUXDB_V2_URL must be set and non-empty}" : "${INFLUXDB_V2_ORG:?Environment variable INFLUXDB_V2_ORG must be set and non-empty}" : "${INFLUXDB_V2_TOKEN:?Environment variable INFLUXDB_V2_TOKEN must be set and non-empty}"...