faker
Wrapper for the Faker Python library
faker : Wrapper for the Faker Python library
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 3210 | faker | faker | 0.5.3 |
LANG | PostgreSQL | Python |
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
| --s-d-- | No | Yes | No | Yes | no | no |
| Relationships | |
|---|---|
| Requires | plpython3u |
| See Also | dbt2 pg_mockable pgtap pgsqlmock omni_test random tsm_system_time tsm_system_rows |
Requires PL/Python3 and Python Faker; the PIGSTY DEB carries a PG17+ parser compatibility patch.
Packages
| Type | Repo | Version | PG Major Compatibility | Package Pattern | Dependencies |
|---|---|---|---|---|---|
| EXT | MIXED | 0.5.3 |
18 17 16 15 14 | faker |
plpython3u |
| RPM | PGDG | 0.5.3 |
18 17 16 15 14 | postgresql_faker_$v |
- |
| DEB | PIGSTY | 0.5.3 |
18 17 16 15 14 | postgresql-$v-faker |
postgresql-plpython3-$v, python3-fake-factory |
| Linux / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
| el8.x86_64 | PGDG 0.5.3 | PGDG 0.5.3 | PGDG 0.5.3 | PGDG 0.5.3 | PGDG 0.5.3 |
| el8.aarch64 | PGDG 0.5.3 | PGDG 0.5.3 | PGDG 0.5.3 | PGDG 0.5.3 | PGDG 0.5.3 |
| el9.x86_64 | PGDG 0.5.3 | PGDG 0.5.3 | PGDG 0.5.3 | PGDG 0.5.3 | PGDG 0.5.3 |
| el9.aarch64 | PGDG 0.5.3 | PGDG 0.5.3 | PGDG 0.5.3 | PGDG 0.5.3 | PGDG 0.5.3 |
| el10.x86_64 | PGDG 0.5.3 | PGDG 0.5.3 | PGDG 0.5.3 | PGDG 0.5.3 | PGDG 0.5.3 |
| el10.aarch64 | PGDG 0.5.3 | PGDG 0.5.3 | PGDG 0.5.3 | PGDG 0.5.3 | PGDG 0.5.3 |
| d12.x86_64 | PIGSTY 0.5.3 | PIGSTY 0.5.3 | PIGSTY 0.5.3 | PIGSTY 0.5.3 | PIGSTY 0.5.3 |
| d12.aarch64 | PIGSTY 0.5.3 | PIGSTY 0.5.3 | PIGSTY 0.5.3 | PIGSTY 0.5.3 | PIGSTY 0.5.3 |
| d13.x86_64 | PIGSTY 0.5.3 | PIGSTY 0.5.3 | PIGSTY 0.5.3 | PIGSTY 0.5.3 | PIGSTY 0.5.3 |
| d13.aarch64 | PIGSTY 0.5.3 | PIGSTY 0.5.3 | PIGSTY 0.5.3 | PIGSTY 0.5.3 | PIGSTY 0.5.3 |
| u22.x86_64 | PIGSTY 0.5.3 | PIGSTY 0.5.3 | PIGSTY 0.5.3 | PIGSTY 0.5.3 | PIGSTY 0.5.3 |
| u22.aarch64 | PIGSTY 0.5.3 | PIGSTY 0.5.3 | PIGSTY 0.5.3 | PIGSTY 0.5.3 | PIGSTY 0.5.3 |
| u24.x86_64 | PIGSTY 0.5.3 | PIGSTY 0.5.3 | PIGSTY 0.5.3 | PIGSTY 0.5.3 | PIGSTY 0.5.3 |
| u24.aarch64 | PIGSTY 0.5.3 | PIGSTY 0.5.3 | PIGSTY 0.5.3 | PIGSTY 0.5.3 | PIGSTY 0.5.3 |
| u26.x86_64 | PIGSTY 0.5.3 | PIGSTY 0.5.3 | PIGSTY 0.5.3 | PIGSTY 0.5.3 | PIGSTY 0.5.3 |
| u26.aarch64 | PIGSTY 0.5.3 | PIGSTY 0.5.3 | PIGSTY 0.5.3 | PIGSTY 0.5.3 | PIGSTY 0.5.3 |
Source
gitlab.com/dalibo/postgresql_faker
postgresql_faker-0.5.3.tar.bz2
Install
Make sure PGDG and PIGSTY repo available:
Install this extension with pig:
Create this extension with:
Usage
faker is a PostgreSQL extension that wraps Python’s Faker library, providing functions to generate realistic fake data directly in SQL queries. It requires plpython3u.
Generate Fake Data
Note: faker.date() and faker.time() are not available because date and time are reserved PostgreSQL keywords. Use faker.date_between() or faker.date_this_century() instead.
Populate Tables with Fake Data
Localized Fake Data
Locale is set per session, not per function call:
Unique Values
Use the unique_ prefix to guarantee unique values within a session:
Discover All Functions
All faker functions return text. Cast explicitly for other types.
Common Faker Providers
| Function | Description |
|---|---|
faker.name() |
Full name |
faker.first_name() |
First name |
faker.last_name() |
Last name |
faker.email() |
Email address |
faker.company_email() |
Company email |
faker.phone_number() |
Phone number |
faker.address() |
Full address |
faker.city() |
City name |
faker.country() |
Country name |
faker.company() |
Company name |
faker.text() |
Random text |
faker.date_this_century() |
Random date |
faker.ssn() |
Social security number |
faker.ean() |
EAN barcode |