graflo.db.postgres.heuristics¶
create_patterns_from_postgres(conn, schema_name=None)
¶
Create Patterns from PostgreSQL tables.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
conn
|
PostgresConnection
|
PostgresConnection instance |
required |
schema_name
|
str | None
|
Schema name to introspect |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
Patterns |
Patterns
|
Patterns object with TablePattern instances for all tables |
Source code in graflo/db/postgres/heuristics.py
create_resources_from_postgres(conn, schema, schema_name=None)
¶
Create Resources from PostgreSQL tables for an existing schema.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
conn
|
PostgresConnection
|
PostgresConnection instance |
required |
schema
|
Existing Schema object |
required | |
schema_name
|
str | None
|
Schema name to introspect |
None
|
Returns:
| Type | Description |
|---|---|
|
list[Resource]: List of Resources for PostgreSQL tables |
Source code in graflo/db/postgres/heuristics.py
infer_schema_from_postgres(conn, schema_name=None, db_flavor=None)
¶
Convenience function to infer a graflo Schema from PostgreSQL database.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
conn
|
PostgresConnection
|
PostgresConnection instance |
required |
schema_name
|
str | None
|
Schema name to introspect (defaults to config schema_name or 'public') |
None
|
db_flavor
|
Target database flavor (defaults to ARANGO) |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
Schema |
Inferred schema with vertices, edges, and resources |