Skip to main content

AI-powered fake data generator for SQLAlchemy models using LLMs

Project description

AI Faker

AI-powered fake data generator for SQLAlchemy models using LLMs (OpenAI, Gemini).

Features

  • Generate realistic fake data using AI/LLM
  • Batch generation for efficiency
  • Support for OpenAI and Google's Gemini
  • SQLAlchemy integration
  • Type-aware data generation
  • Unique constraint handling
  • Relationship support

Installation

# Install with OpenAI support
pip install ai_faker[openai]

# Install with Gemini support
pip install ai_faker[gemini]

# Install with all providers
pip install ai_faker[all]

Quick Start

from sqlalchemy import create_engine, Column, Integer, String
from sqlalchemy.orm import declarative_base
from ai_faker import DataGenerator, LLMInterface
from ai_faker.core.llm_providers import OpenAIProvider

# Create your SQLAlchemy model
Base = declarative_base()

class User(Base):
    __tablename__ = 'users'
    id = Column(Integer, primary_key=True)
    username = Column(String(50), unique=True)
    email = Column(String(100), unique=True)

# Initialize the provider and generator
provider = OpenAIProvider(api_key="your-api-key")
llm = LLMInterface(provider)
generator = DataGenerator(llm)

# Generate fake data
fake_users = generator.generate_fake_data(User, count=50)

print(fake_users)

Environment Variables

Create a .env file:

# OpenAI
OPENAI_API_KEY=your-openai-key

# Gemini
GOOGLE_API_KEY=your-google-key

Supported Providers

OpenAI

  • Uses GPT models
  • Requires OpenAI API key

Gemini

  • Uses Google's Gemini models
  • Requires Google API key

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sql_ai_faker-1.0.0.tar.gz (15.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sql_ai_faker-1.0.0-py3-none-any.whl (17.0 kB view details)

Uploaded Python 3

File details

Details for the file sql_ai_faker-1.0.0.tar.gz.

File metadata

  • Download URL: sql_ai_faker-1.0.0.tar.gz
  • Upload date:
  • Size: 15.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for sql_ai_faker-1.0.0.tar.gz
Algorithm Hash digest
SHA256 5a39e40004a3f5de7ef1b9c036ab6413ff90b98b68f93aa67d67a96f44a6525a
MD5 d22b89fd18d9d2e5895bec8a49f1122a
BLAKE2b-256 0940ac5bdfbb159b5b1ed93eb75a255c279cb8136af3918dee3809b9bb47418a

See more details on using hashes here.

File details

Details for the file sql_ai_faker-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: sql_ai_faker-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 17.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for sql_ai_faker-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2790619406075a673dd58f48ee0f51dee2a7d98ab3e6b5252046b58a0d9b974c
MD5 caaabc3f49c449874f876e60cc275394
BLAKE2b-256 8b188de1d99772c1e01d01f7590cc4bc849c39fafed9aac901c0a7953d389d84

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page