graflo.architecture.contract.bindings.connectors¶
Resource connector types (file, SQL table, SPARQL, API, Kafka).
Attributes¶
TEMPLATE_VARIABLE = re.compile('\\{([A-Za-z_][A-Za-z0-9_]*)\\}')
module-attribute
¶
TemplateValue = str | int | float | bool
module-attribute
¶
Classes¶
APIConnector
¶
Bases: TemplatedConnector
Connector for REST API endpoints.
Declares the non-secret access pattern (path, method, pagination). Runtime
base_url and credentials are supplied via connector_connection ->
conn_proxy -> :class:~graflo.connections.sources.RestApiConnConfig.
path and params are address templates and body a query text
(see :class:TemplatedConnector); their variables come from values
and from parent.fields.
Attributes:
| Name | Type | Description |
|---|---|---|
path |
str
|
Relative endpoint path (e.g. |
method |
str
|
HTTP method (default |
params |
dict[str, Any]
|
Static query parameters. |
body |
dict[str, Any] | str | None
|
Request body: a mapping is sent as JSON, a string as is. Not
allowed with |
pagination |
PaginationConfig | None
|
Pagination strategy and response path configuration. |
row_annotations |
dict[str, Any]
|
Constant fields merged into every fetched document (doc wins). |
headers |
dict[str, str]
|
Non-secret HTTP headers. |
timeout |
float | None
|
Request timeout in seconds. |
retries |
int
|
Number of retry attempts. |
retry_backoff_factor |
float
|
Backoff factor for retries. |
retry_status_forcelist |
list[int]
|
HTTP status codes to retry on. A |
verify |
bool
|
Verify SSL certificates. |
watermark |
WatermarkConfig | None
|
Where a run left off; see :class: |
parent |
ParentRequest | None
|
Make one request per record of another API connector, with
|
values |
dict[str, list[TemplateValue]] | None
|
One request per value of each variable; see
:class: |
Source code in graflo/architecture/contract/bindings/connectors.py
1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 | |
Attributes¶
body = None
class-attribute
instance-attribute
¶
headers = Field(default_factory=dict)
class-attribute
instance-attribute
¶
method = 'GET'
class-attribute
instance-attribute
¶
pagination = None
class-attribute
instance-attribute
¶
params = Field(default_factory=dict)
class-attribute
instance-attribute
¶
parent = None
class-attribute
instance-attribute
¶
path = Field(..., description='Relative API endpoint path')
class-attribute
instance-attribute
¶
retries = 0
class-attribute
instance-attribute
¶
retry_backoff_factor = 0.1
class-attribute
instance-attribute
¶
retry_status_forcelist = Field(default_factory=lambda: [429, 500, 502, 503, 504])
class-attribute
instance-attribute
¶
timeout = None
class-attribute
instance-attribute
¶
verify = True
class-attribute
instance-attribute
¶
watermark = None
class-attribute
instance-attribute
¶
Methods:¶
bound_source_kind()
¶
build_api_config(*, base_url, auth=None, default_headers=None, page_size_override=None)
¶
Merge contract fields with runtime connection config into APIConfig.
Source code in graflo/architecture/contract/bindings/connectors.py
matches(resource_identifier)
¶
Match resource name, connector name, or path tail.
Source code in graflo/architecture/contract/bindings/connectors.py
rendered(values)
¶
Source code in graflo/architecture/contract/bindings/connectors.py
ApiResponseStructure
¶
Bases: ConfigBaseModel
Maps JSON response envelope fields to extraction and pagination signals.
Source code in graflo/architecture/contract/bindings/connectors.py
Attributes¶
auto_detect = Field(default=False, description='When true, infer unset response paths from the first response body.')
class-attribute
instance-attribute
¶
batch_metadata_paths = Field(default_factory=dict, description='Map row annotation keys to response dot paths (e.g. ``_batch_id: result_id``).')
class-attribute
instance-attribute
¶
cursor_path = Field(default=None, description='Dot path to the next opaque cursor token.')
class-attribute
instance-attribute
¶
error_path = Field(default=None, description='Dot path to an error code in the response body (e.g. ``error``). Named in the raised error; a non-empty value raises on its own.')
class-attribute
instance-attribute
¶
has_more_path = Field(default=None, description='Dot path to a boolean more-pages flag (e.g. ``has_more``).')
class-attribute
instance-attribute
¶
next_offset_path = Field(default=None, description='Dot path to server-provided next offset for the following request (e.g. ``next_offset``).')
class-attribute
instance-attribute
¶
offset_path = Field(default=None, description='Dot path to echoed page start index (e.g. ``offset``).')
class-attribute
instance-attribute
¶
ok_path = Field(default=None, description='Dot path to a success flag in every response body (e.g. ``ok``). A body where it is not ``true`` raises, even with HTTP status 200.')
class-attribute
instance-attribute
¶
records_path = Field(default=None, description='Dot path to the record list (e.g. ``results``).')
class-attribute
instance-attribute
¶
total_count_path = Field(default=None, description='Dot path to total item count across all pages (e.g. ``count``).')
class-attribute
instance-attribute
¶
BoundSourceKind
¶
Bases: BaseEnum
Physical source modality for a bound connector (how rows are retrieved).
This describes the connector-backed access pattern, not the abstract ingestion resource. File format (CSV, JSON, etc.) is chosen by the loader from file extensions.
Attributes:
| Name | Type | Description |
|---|---|---|
FILE |
File-based connector (directory + pattern or paths). |
|
SQL_TABLE |
SQL table / database-backed connector. |
|
SPARQL |
SPARQL / RDF connector (endpoint or local RDF via rdflib). |
|
API |
REST API connector (path + pagination on a runtime base URL). |
|
KAFKA |
Kafka topic consumer (topics + group_id on a runtime bootstrap). |
|
PUSH |
Records handed to the resource by the caller; no address. |
Source code in graflo/architecture/contract/bindings/connectors.py
Attributes¶
API = 'api'
class-attribute
instance-attribute
¶
FILE = 'file'
class-attribute
instance-attribute
¶
KAFKA = 'kafka'
class-attribute
instance-attribute
¶
PUSH = 'push'
class-attribute
instance-attribute
¶
SPARQL = 'sparql'
class-attribute
instance-attribute
¶
SQL_TABLE = 'sql_table'
class-attribute
instance-attribute
¶
ConnectorUpdate
¶
Bases: ConfigBaseModel
Patch payload for an existing connector (applied after manifest load).
Only connector is a fixed field; any other keys are captured as extras and
merged into the resolved connector via model_validate (so validators,
including hash recomputation, run). New connector types and fields do not
require changes to this model. Not part of the stored GraphManifest;
load from a separate file or build in code, then call
Bindings.apply_connector_update.
Attributes:
| Name | Type | Description |
|---|---|---|
connector |
str
|
Connector |
Source code in graflo/architecture/contract/bindings/connectors.py
FileConnector
¶
Bases: ResourceConnector
Connector for matching files.
Attributes:
| Name | Type | Description |
|---|---|---|
regex |
str | None
|
Regular expression pattern for matching filenames |
sub_path |
Path
|
Directory to search for matching files (default: "./"). With
a |
recursive |
bool
|
Also search the directories under |
file_type |
Literal['json', 'jsonl', 'table', 'parquet'] | None
|
Format of the matched files, for names that do not show it. Left unset, the format comes from the extension. |
time_filter |
ColumnTimeFilter | None
|
Refused when set. A file is read whole, so a window
declared here would not be applied; filter the rows in a pipeline
step, or bind a :class: |
Source code in graflo/architecture/contract/bindings/connectors.py
Attributes¶
file_type = None
class-attribute
instance-attribute
¶
recursive = False
class-attribute
instance-attribute
¶
regex = None
class-attribute
instance-attribute
¶
sub_path = Field(default_factory=lambda: pathlib.Path('./'))
class-attribute
instance-attribute
¶
takes_default_conn_proxy = False
class-attribute
¶
time_filter = None
class-attribute
instance-attribute
¶
Methods:¶
bound_source_kind()
¶
matches(resource_identifier)
¶
Check if connector matches a filename.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
resource_identifier
|
str
|
Filename to match |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if connector matches |
Source code in graflo/architecture/contract/bindings/connectors.py
KafkaConnector
¶
Bases: ResourceConnector
Connector for Kafka topic consumption.
Declares the non-secret access pattern (topics, consumer group, decode
options). Runtime bootstrap servers and credentials are supplied via
connector_connection -> conn_proxy ->
:class:~graflo.connections.sources.KafkaConnConfig.
Attributes:
| Name | Type | Description |
|---|---|---|
topics |
list[str]
|
Topic names to subscribe to. |
group_id |
str
|
Kafka consumer group id. |
auto_offset_reset |
Literal['earliest', 'latest']
|
Where to start when no committed offset exists. |
value_encoding |
Literal['json']
|
Payload decode mode ( |
include_headers |
bool
|
When True, attach decoded headers under |
idle_ms |
int
|
Stop after this many milliseconds with no messages. |
max_wait_ms |
int | None
|
Hard wall-clock cap for a single |
poll_timeout_ms |
int
|
Per-poll timeout passed to the Kafka client. |
row_annotations |
dict[str, Any]
|
Constant fields merged into every decoded document (doc wins). |
Source code in graflo/architecture/contract/bindings/connectors.py
1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 | |
Attributes¶
auto_offset_reset = 'earliest'
class-attribute
instance-attribute
¶
group_id = Field(..., description='Consumer group id')
class-attribute
instance-attribute
¶
idle_ms = Field(default=2000, ge=0, description='Stop after this many ms with no messages (0 disables idle stop).')
class-attribute
instance-attribute
¶
include_headers = False
class-attribute
instance-attribute
¶
max_wait_ms = Field(default=None, ge=0, description='Optional wall-clock cap for one consume run.')
class-attribute
instance-attribute
¶
poll_timeout_ms = Field(default=500, ge=1, description='Timeout for each consumer poll call.')
class-attribute
instance-attribute
¶
topics = Field(..., min_length=1, description='Kafka topics to consume')
class-attribute
instance-attribute
¶
value_encoding = 'json'
class-attribute
instance-attribute
¶
Methods:¶
bound_source_kind()
¶
build_kafka_config(*, conn)
¶
Merge contract fields with runtime connection config into KafkaConfig.
Source code in graflo/architecture/contract/bindings/connectors.py
matches(resource_identifier)
¶
Match resource name, connector name, or a subscribed topic.
Source code in graflo/architecture/contract/bindings/connectors.py
PaginationConfig
¶
Bases: ConfigBaseModel
Configuration for API pagination (contract-level, secret-free).
Combines request construction (request) with response envelope parsing
(response).
Source code in graflo/architecture/contract/bindings/connectors.py
PaginationRequestConfig
¶
Bases: ConfigBaseModel
Configuration for building paginated HTTP requests.
Source code in graflo/architecture/contract/bindings/connectors.py
Attributes¶
carry_params = Field(default_factory=dict, description="Query param name -> response dot path. After each page, values are read and sent on later requests (e.g. ``results_id: '0.results_id'``). When empty, known session-token fields are auto-detected from the first response.")
class-attribute
instance-attribute
¶
cursor_param = 'cursor'
class-attribute
instance-attribute
¶
initial_cursor = None
class-attribute
instance-attribute
¶
initial_offset = 0
class-attribute
instance-attribute
¶
initial_page = 1
class-attribute
instance-attribute
¶
limit_param = Field(default='limit', description='Query parameter name for page size (offset strategy only). The value sent is ``page_size``, not a total item cap. When ``None``, no page-size query parameter is sent.')
class-attribute
instance-attribute
¶
offset_param = 'offset'
class-attribute
instance-attribute
¶
page_param = 'page'
class-attribute
instance-attribute
¶
page_size = Field(default=100, description='Records requested per HTTP page. Sent as the value of ``limit_param`` (offset) or ``per_page_param`` (page) when those param names are set.')
class-attribute
instance-attribute
¶
per_page_param = Field(default='per_page', description='Query parameter name for page size (page strategy only). The value sent is ``page_size``, not a total item cap.')
class-attribute
instance-attribute
¶
strategy = 'offset'
class-attribute
instance-attribute
¶
ParentRequest
¶
Bases: ConfigBaseModel
Make one request per record of another API connector.
Attributes:
| Name | Type | Description |
|---|---|---|
connector |
str
|
Name of the parent API connector in the same bindings. |
fields |
dict[str, str]
|
Template variable -> dot path into a parent record. Each
variable fills |
Source code in graflo/architecture/contract/bindings/connectors.py
PushConnector
¶
Bases: ResourceConnector
Connector for records pushed to a resource rather than fetched.
It has no address: the caller hands the records over at run time
(RegistryBuilder.build(pushed=...)), keyed by the connector name. Declaring
it keeps what a resource accepts versioned and reviewable like any other
source.
Attributes:
| Name | Type | Description |
|---|---|---|
kind |
Literal['push']
|
Always |
name |
str
|
Name the pushed records are keyed by. |
records_path |
str | None
|
Dot path to the record list when a pushed item is an envelope rather than a record. |
row_annotations |
dict[str, Any]
|
Constant fields merged into every record (record wins). |
Source code in graflo/architecture/contract/bindings/connectors.py
Attributes¶
kind
instance-attribute
¶
name = Field(..., min_length=1)
class-attribute
instance-attribute
¶
records_path = None
class-attribute
instance-attribute
¶
takes_default_conn_proxy = False
class-attribute
¶
Methods:¶
bound_source_kind()
¶
matches(resource_identifier)
¶
Match connector name or resource name.
Source code in graflo/architecture/contract/bindings/connectors.py
ResourceConnector
¶
Bases: ConfigBaseModel, ABC
Abstract base class for resource connectors (files or tables).
Provides common API for connector matching and resource identification. All concrete connector types inherit from this class.
Connectors only describe source-side matching/query behavior. Resource-to-
connector linkage is handled by Bindings.
Source code in graflo/architecture/contract/bindings/connectors.py
Attributes¶
hash = Field(default='', exclude=True, description='Deterministic internal connector id derived from defining fields.')
class-attribute
instance-attribute
¶
name = Field(default=None, description='Optional connector name used by top-level resource_connector mapping.')
class-attribute
instance-attribute
¶
resource_name = Field(default=None, description='Optional direct resource binding declared on the connector itself.')
class-attribute
instance-attribute
¶
row_annotations = Field(default_factory=dict, description='Constant fields merged into every fetched row as defaults (response fields take priority). Implemented for :class:`APIConnector` and :class:`KafkaConnector`; other connector types reject non-empty values.')
class-attribute
instance-attribute
¶
takes_default_conn_proxy = True
class-attribute
¶
Methods:¶
bound_source_kind()
abstractmethod
¶
matches(resource_identifier)
abstractmethod
¶
Check if connector matches a resource identifier.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
resource_identifier
|
str
|
Identifier to match (filename or table name) |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if connector matches |
Source code in graflo/architecture/contract/bindings/connectors.py
row_constants()
¶
The constant fields this connector puts on its rows, one mapping per request.
A row field of the same name wins over a constant, so these are what the connector fixes, not what every row ends up holding.
Source code in graflo/architecture/contract/bindings/connectors.py
SparqlConnector
¶
Bases: TemplatedConnector
Connector for matching SPARQL / RDF data sources.
Each request targets instances of a single rdf:Class; with values
the connector makes one request per value (see :class:TemplatedConnector).
rdf_class and graph_uri are address templates, sparql_query a
query text. It can be backed either by a remote SPARQL endpoint (Fuseki,
Blazegraph, ...) or by a local RDF file parsed with rdflib.
Attributes:
| Name | Type | Description |
|---|---|---|
rdf_class |
str
|
Full URI of the |
endpoint_url |
str | None
|
SPARQL query endpoint URL. When set, instances are
fetched via HTTP. When |
graph_uri |
str | None
|
Named-graph URI to restrict the query to (optional). |
sparql_query |
str | None
|
Custom SPARQL |
rdf_file |
Path | None
|
Path to a local RDF file ( |
same_as |
Literal['collapse', 'keep']
|
|
Source code in graflo/architecture/contract/bindings/connectors.py
758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 | |
Attributes¶
endpoint_url = Field(default=None, description='SPARQL query endpoint URL')
class-attribute
instance-attribute
¶
graph_uri = Field(default=None, description='Named graph URI (optional)')
class-attribute
instance-attribute
¶
rdf_class = Field(..., description='URI of the rdf:Class to fetch instances of')
class-attribute
instance-attribute
¶
rdf_file = Field(default=None, description='Path to a local RDF file')
class-attribute
instance-attribute
¶
same_as = Field(default='collapse', description='How owl:sameAs statements between IRIs are read.')
class-attribute
instance-attribute
¶
sparql_query = Field(default=None, description='Custom SPARQL query override')
class-attribute
instance-attribute
¶
typed_objects = Field(default_factory=list, description='Properties (local names) whose objects are also read by class, as ``<property>@<Class>``: for a property with several ranges.')
class-attribute
instance-attribute
¶
Methods:¶
bound_source_kind()
¶
build_select_query()
¶
Build a SPARQL SELECT query for instances of rdf_class.
If sparql_query is set it is returned as-is. Otherwise a simple per-class query is generated::
SELECT ?s ?p ?o WHERE {
?s a <rdf_class> .
?s ?p ?o .
}
Returns:
| Type | Description |
|---|---|
str
|
SPARQL query string |
Source code in graflo/architecture/contract/bindings/connectors.py
matches(resource_identifier)
¶
Match by the local name (fragment) of the rdf:Class URI.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
resource_identifier
|
str
|
Identifier to match against |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True when resource_identifier equals the class local name |
Source code in graflo/architecture/contract/bindings/connectors.py
rendered(values)
¶
Source code in graflo/architecture/contract/bindings/connectors.py
TableConnector
¶
Bases: ResourceConnector
Connector for matching database tables.
Supports simple single-table queries as well as multi-table JOINs and
pushdown filters via FilterExpression.
Attributes:
| Name | Type | Description |
|---|---|---|
table_name |
str
|
Exact table name or regex pattern |
schema_name |
str | None
|
Schema name (optional, defaults to public) |
database |
str | None
|
Database name (optional) |
time_filter |
ColumnTimeFilter | None
|
Optional structured filter on a date/time column, rendered
via :class: |
filters |
list[Any]
|
General-purpose pushdown filters rendered as SQL WHERE fragments. |
joins |
list[JoinClause]
|
Multi-table JOIN specifications (auto-generated or explicit). |
base_alias |
str
|
SQL alias for the base table when |
select_columns |
list[str] | None
|
Explicit SELECT column list. None means |
Source code in graflo/architecture/contract/bindings/connectors.py
425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 | |
Attributes¶
base_alias = Field(default='base', description='SQL alias for the base table row when joins are present.')
class-attribute
instance-attribute
¶
database = None
class-attribute
instance-attribute
¶
date_field
property
¶
Column used for time filtering, if any (compat alias for time_filter.column).
filters = Field(default_factory=list, description='Pushdown FilterExpression filters (rendered to SQL WHERE).')
class-attribute
instance-attribute
¶
joins = Field(default_factory=list, description='JOIN clauses for multi-table queries.')
class-attribute
instance-attribute
¶
schema_name = Field(default=None, validation_alias=AliasChoices('schema_name', 'schema'))
class-attribute
instance-attribute
¶
select_columns = Field(default=None, description='Explicit SELECT columns. None = SELECT * (plus join aliases).')
class-attribute
instance-attribute
¶
table_name = Field(default='', validation_alias=AliasChoices('table_name', 'table'))
class-attribute
instance-attribute
¶
time_filter = None
class-attribute
instance-attribute
¶
view = Field(default=None, description='SelectSpec or dict for declarative view (alternative to table+joins+filters).')
class-attribute
instance-attribute
¶
Methods:¶
bound_source_kind()
¶
build_query(effective_schema=None, *, extra_filters=())
¶
Build a complete SQL SELECT query.
When view is set, delegates to view.build_sql(). Otherwise
incorporates the base table, any JoinClauses, explicit select_columns,
time_filter, and FilterExpression filters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
effective_schema
|
str | None
|
Schema to use if |
None
|
extra_filters
|
Sequence[FilterExpression]
|
Conditions for this run only, such as a date range supplied at ingestion time. They are ANDed with the declared ones and qualified like them. |
()
|
Returns:
| Type | Description |
|---|---|
str
|
Complete SQL query string. |
Source code in graflo/architecture/contract/bindings/connectors.py
603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 | |
build_where_clause(base_alias=None, extra_filters=())
¶
Build SQL WHERE clause from time filter and general filters.
Returns:
| Type | Description |
|---|---|
str
|
WHERE clause string (without the WHERE keyword) or empty string if no filters |
Source code in graflo/architecture/contract/bindings/connectors.py
matches(resource_identifier)
¶
Check if connector matches a table name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
resource_identifier
|
str
|
Table name to match (format: schema.table or just table) |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if connector matches |
Source code in graflo/architecture/contract/bindings/connectors.py
source_column(name)
¶
The column the query's output name reads, as a filter field.
A base column is returned bare (conditions qualify it with the base
alias), a joined one as alias.column. None when the query's
output names are not known: raw select_columns, or a join that
selects all its columns.
Source code in graflo/architecture/contract/bindings/connectors.py
where_conditions(base_alias=None, extra_filters=())
¶
The connector's SQL conditions, each safe as one operand of AND.
In order: the time filter, the declared filters, then
extra_filters (conditions supplied for one run). With base_alias,
unqualified columns are qualified with it.
Source code in graflo/architecture/contract/bindings/connectors.py
TemplatedConnector
¶
Bases: ResourceConnector, ABC
A connector whose request fields may hold {name} variables.
values enumerates variables. The connector then makes one request per
combination of their values -- in declaration order, the last variable
varying fastest -- with the variables filled in, and every row carries the
variables as fields unless it has a field of the same name. Which record
becomes what is the resource's to say (a vertex_router on that field);
the connector names no vertex.
Template fields are of two kinds. In an address (a URL path, a query
parameter, an IRI) every {name} must be a declared variable. In a
query text (a request body, a SPARQL query) braces are syntax, so only
declared variables are filled and every other brace pair is literal.
Attributes:
| Name | Type | Description |
|---|---|---|
values |
dict[str, list[TemplateValue]] | None
|
Variable name -> the values it takes, in request order. Every variable must be used in a template field. |
Source code in graflo/architecture/contract/bindings/connectors.py
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 | |
Attributes¶
values = Field(default=None, description='Variable -> values; one request per combination, each row carrying the variables as fields.')
class-attribute
instance-attribute
¶
Methods:¶
rendered(values)
abstractmethod
¶
A copy for one request: template fields filled from values, no values.
The copy keeps this connector's name and hash, so its connection and bindings still resolve to it.
Source code in graflo/architecture/contract/bindings/connectors.py
row_constants()
¶
value_combinations()
¶
One mapping per request, in request order; [{}] without values.
Source code in graflo/architecture/contract/bindings/connectors.py
WatermarkConfig
¶
Bases: ConfigBaseModel
Where an API source left off, and how to ask it to resume from there.
The source tracks the largest value of field over the rows it yields.
Values compare as numbers when both parse as numbers, and as text
otherwise, so timestamps must be written in one sortable form (ISO 8601 in
one zone). The caller stores that value and renders it into the next run's
query parameters; GraFlo keeps no run state itself.
Attributes:
| Name | Type | Description |
|---|---|---|
field |
str
|
Dot path of the value on each row. |
param |
str
|
Query parameter that carries the value on the next run. |
template |
str | None
|
Parameter text with a |
format |
str | None
|
strftime pattern the value is rendered with, in UTC, before
the template, for an API whose query language takes another time
form than its records carry ( |
Source code in graflo/architecture/contract/bindings/connectors.py
Attributes¶
field = Field(..., min_length=1)
class-attribute
instance-attribute
¶
format = None
class-attribute
instance-attribute
¶
param = Field(..., min_length=1)
class-attribute
instance-attribute
¶
template = None
class-attribute
instance-attribute
¶
Methods:¶
format_value(value)
¶
value as the API takes it: rendered by format, else unchanged.
Raises:
| Type | Description |
|---|---|
ValueError
|
With |
Source code in graflo/architecture/contract/bindings/connectors.py
render(value)
¶
Return the query parameters that resume from value.
Source code in graflo/architecture/contract/bindings/connectors.py
Functions:¶
render_body(body, values)
¶
Fill a request body: a string as text, a JSON structure by :func:render_param.
Source code in graflo/architecture/contract/bindings/connectors.py
render_param(value, values)
¶
Fill the strings of a JSON-like value, at any depth; keys stay as written.
A string that is exactly {name} for a name in values becomes the
value itself, its type kept; any other string is filled as text.
Source code in graflo/architecture/contract/bindings/connectors.py
render_text(template, values, *, quote_values=False)
¶
Fill {name} for every name in values; any other brace pair stays as written.
With quote_values each value is percent-encoded, for a URL path.
Source code in graflo/architecture/contract/bindings/connectors.py
template_variables(*parts)
¶
The {name} variables in the strings of parts, at any depth.