Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions sinks/aerospike/generate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
from faker import Faker
import csv
import random
from tqdm import tqdm

fake = Faker()

# Generate customers data
customers = []
for i in tqdm(range(100000)): # Generate 100 customers
customer = [
i, # Assuming customer_id starts at 0
fake.first_name(),
fake.last_name(),
fake.date_of_birth(minimum_age=18, maximum_age=90).isoformat(),
fake.email(),
fake.phone_number(),
fake.address().replace('\n', ', '), # Replace newlines in address
fake.city(),
fake.state(),
fake.zipcode(),
fake.country(),
]
customers.append(customer)

print("customers completed")
# Write customers to CSV
with open('customers.csv', 'w', encoding='utf-8') as file:
writer = csv.writer(file, delimiter=',', lineterminator='\r\n', quoting=csv.QUOTE_NONNUMERIC)
writer.writerow(['customer_id', 'first_name', 'last_name', 'dob', 'email', 'phone_number', 'address', 'city', 'state', 'zip_code', 'country'])
writer.writerows(customers)

# Generate transactions data
transactions = []
for i in tqdm(range(5000000)): # Generate 500 transactions
transaction = [
i, # Assuming transaction_id starts at 0
random.randint(0, len(customers)), # Assuming customer IDs range from 0 to 99
random.choice(['Deposit', 'Withdrawal', 'Transfer']),
round(random.uniform(10.00, 10000.00), 2),
'USD',
fake.date_this_year().isoformat(),
random.choice(['Completed', 'Pending', 'Cancelled']),
fake.sentence(),
]
transactions.append(transaction)

# Write transactions to CSV
with open('transactions.csv', 'w', encoding='utf-8') as file:
writer = csv.writer(file, delimiter=',', lineterminator='\r\n', quoting=csv.QUOTE_NONNUMERIC)
writer.writerow(['transaction_id', 'customer_id', 'type', 'amount', 'currency', 'transaction_date', 'status', 'description'])
writer.writerows(transactions)
76 changes: 76 additions & 0 deletions sinks/aerospike/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions sinks/aerospike/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[tool.poetry]
name = "aerospike"
version = "0.1.0"
description = ""
authors = ["VG <vivekg342@gmail.com>"]
readme = "README.md"

[tool.poetry.dependencies]
python = "^3.9"
faker = "^22.6.0"
tqdm = "^4.66.1"


[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"