# Chalk Python SDK Reference
source: https://docs.chalk.ai/api-docs

The `chalk` Python package: features, resolvers, SQL sources, streams, clients, and built-in functions.

Each section of this reference is a separate Markdown file, listed with the items it documents.

- [Features](https://docs.chalk.ai/api-docs/features.md): @features, feature, has_one, has_many, after, before, Windowed, windowed, MaterializationWindowConfig, Primary, Validation, Vector
- [Resolvers](https://docs.chalk.ai/api-docs/resolvers.md): @online, @offline, Cron, ResolverProtocol, ChalkContext, MachineType
- [DataFrame](https://docs.chalk.ai/api-docs/dataframe.md): DataFrame
- [SQL](https://docs.chalk.ai/api-docs/sql.md): AthenaSource, BigQuerySource, CloudSQLSource, DatabricksSource, DynamoDBSource, MySQLSource, PostgreSQLSource, RedshiftSource, SnowflakeSource, SpannerSource, SQLiteFileSource, SQLiteInMemorySource, IncrementalSettings, BaseSQLSourceProtocol, SQLSourceWithTableIngestProtocol, TableIngestProtocol, ChalkQueryProtocol, StringChalkQueryProtocol, make_sql_file_resolver
- [Streams](https://docs.chalk.ai/api-docs/streams.md): @stream, KafkaSource, KinesisSource, PubSubSource, StreamSource, make_stream_resolver, Sink
- [Client](https://docs.chalk.ai/api-docs/client.md), in 5 files:
  - [Client: ChalkClient](https://docs.chalk.ai/api-docs/client-chalkclient.md): ChalkClient
  - [Client: ChalkGRPCClient](https://docs.chalk.ai/api-docs/client-chalkgrpcclient.md): ChalkGRPCClient
  - [Client: AsyncChalkClient](https://docs.chalk.ai/api-docs/client-asyncchalkclient.md): AsyncChalkClient
  - [Client, part 1](https://docs.chalk.ai/api-docs/client-part-1.md): AsyncChalkGRPCClient, FeatureResult, ChalkError, DatasetRevision, Dataset
  - [Client, part 2](https://docs.chalk.ai/api-docs/client-part-2.md): ErrorCodeCategory, ErrorCode, ChalkException, ResourceRequests, OnlineQuery, OnlineQueryResult, NamedQuery, OfflineQueryContext, OnlineQueryContext, ChalkAuthException, OfflineQueryDeadlineOptions, ModelType, ModelClass, ModelEncoding, SourceConfig, ModelRunCriterion, ModelVersionResponse, DeployedModelVersion, RegisteredModelVersion, ModelDeployment, ModelDeploymentSpec, ModelDeploymentRevision, ListModelDeploymentsResponse, ListModelDeploymentRevisionsResponse, ModelDeploymentError, ModelDeploymentFailedError, ModelDeploymentTimeoutError
- [Integrations](https://docs.chalk.ai/api-docs/integrations.md): APINamespace, DatasourceAPI, Datasource, DatasourceTestResult, IntegrationKind
- [Utils](https://docs.chalk.ai/api-docs/utils.md): Duration, CronTab, Environments, Tags, owner, tags, description, is_primary, is_feature_time, AnyDataclass, ChalkBaseException
- [Scheduled Queries](https://docs.chalk.ai/api-docs/scheduled-queries.md): ScheduledQuery
- [Hooks](https://docs.chalk.ai/api-docs/hooks.md): before_all, after_all
- [Charts](https://docs.chalk.ai/api-docs/charts.md): Chart, Series
- [Testing](https://docs.chalk.ai/api-docs/testing.md): assert_frame_equal, freeze_time
- [Chalk Functions](https://docs.chalk.ai/api-docs/chalk-functions.md)
- [Logical Functions](https://docs.chalk.ai/api-docs/logical-functions.md): between, cast, coalesce, distinct_from, is_null, if_then_else, recover, when
- [ML Modeling Functions](https://docs.chalk.ai/api-docs/ml-modeling-functions.md): sagemaker_predict, vertex_predict, sklearn_decision_tree_classifier, sklearn_decision_tree_regressor, sklearn_gradient_boosting_regressor, sklearn_logistic_regression, sklearn_random_forest_classifier, sklearn_random_forest_regressor, xgboost_regressor, width_bucket
- [Prompt Functions](https://docs.chalk.ai/api-docs/prompt-functions.md): jinja, completion, Prompt, MultimodalPrompt, Usage, RuntimeStats, PromptResponse, MultimodalPromptResponse
- [Functions continued](https://docs.chalk.ai/api-docs/functions-continued.md)
- [String Functions](https://docs.chalk.ai/api-docs/string-functions.md): chr, ends_with, jaccard_similarity, jaro_winkler_distance, levenshtein_distance, length, like, lower, lpad, partial_ratio, regexp_extract, regexp_extract_all, regexp_like, regexp_replace, regexp_split, replace, reverse, rpad, sequence_matcher_ratio, split, split_part, starts_with, strpos, strrpos, substr, token_set_ratio, token_sort_ratio, trim, unidecode_normalize, unidecode_to_ascii, upper, word_stem, string_to_bytes
- [Math Functions](https://docs.chalk.ai/api-docs/math-functions.md): abs, acos, asin, bankers_round, ceil, clamp, cos, cosine_similarity, e, exp, floor, from_base, greatest, haversine, least, ln, max, min, mod, pi, power, radians, rand, round, safe_divide, sigmoid, sin, sqrt, to_base
- [Date and Time Functions](https://docs.chalk.ai/api-docs/date-and-time-functions.md): current_bucket_end, current_bucket_start, date_trunc, day_of_month, day_of_week, day_of_year, DayOfWeek, format_datetime, from_iso8601_timestamp, from_unix_milliseconds, from_unix_seconds, hour_of_day, is_leap_year, is_month_end, is_us_federal_holiday, last_day_of_month, month_of_year, nth_bucket_end, nth_bucket_start, parse_datetime, quarter, to_iso8601, total_seconds, unix_milliseconds, unix_seconds, week_of_year, year
- [URL Functions](https://docs.chalk.ai/api-docs/url-functions.md): url_extract_host, url_extract_path, url_extract_protocol
- [Array Functions](https://docs.chalk.ai/api-docs/array-functions.md): array_agg, array_average, array_count_value, array_cum_sum, array_distinct, array_duplicates, array_except, array_has_duplicates, array_intersect, array_join, array_max, array_median, array_min, array_mode, array_normalize, array_position, array_remove, array_sample_stddev, array_sort, array_stddev, array_sum, arrays_overlap, cardinality, contains, element_at, flatten, head, max_by, max_by_n, min_by, min_by_n, remove_nulls, sequence, shuffle, slice
- [Random Functions](https://docs.chalk.ai/api-docs/random-functions.md): random, secure_random
- [HTTP Functions](https://docs.chalk.ai/api-docs/http-functions.md): http_delete, http_get, http_post, http_put, http_request
- [Bitwise Functions](https://docs.chalk.ai/api-docs/bitwise-functions.md): bitwise_and, bitwise_arithmetic_shift_right, bitwise_not, bitwise_or, bitwise_xor
- [Hash Functions](https://docs.chalk.ai/api-docs/hash-functions.md): md5, sha1, sha256, sha512, spooky_hash_v2_32, spooky_hash_v2_64
- [JSON Functions](https://docs.chalk.ai/api-docs/json-functions.md): json_extract_array, json_value, jsonify
- [Bytes Functions](https://docs.chalk.ai/api-docs/bytes-functions.md): bytes_to_string, from_big_endian_64, from_big_endian_32, gunzip, from_snappy
- [Data Structure Functions](https://docs.chalk.ai/api-docs/data-structure-functions.md): map_dict, map_get, proto_deserialize, proto_serialize, struct_pack
- [Miscellaneous](https://docs.chalk.ai/api-docs/miscellaneous.md), in 2 files:
  - [Miscellaneous, part 1](https://docs.chalk.ai/api-docs/miscellaneous-part-1.md): ClickhouseSource, MSSQLSource, TrinoSource, __getattr__, add_features, ai_classify, array, array_add, array_adjacent_difference, array_filter, array_reduce, array_transform, atan, atan2, auto_scaling_spec_from_proto, auto_scaling_spec_to_proto, avro_deserialize, bedrock_embed, bedrock_predict, bind_inputs, bitwise_left_shift, bitwise_right_shift, build_image_from_spec_bytes, build_image_from_spec_with_files, build_inferred_image, cached_member_fn, call_model_url, call_resolver, catalog_call, catalog_call_async, cbrt, centered, chalk_encoder, chalk_handler_volume_name, check_expression, check_static_dataframe, check_stream_parsing, compute_class_to_proto, concat, cosh, cpc_cardinality, cpc_sketch, cpc_sketch_of, cpc_union, cum_count, cum_max, cum_mean, cum_min, cum_prod, cum_sum, cume_dist, cumulative, current_or_new_trace_context, current_trace_context, datetime_to_proto_timestamp, day, decision_complete, degrees, dot_product, embed, encode_outputs, enqueue_model_call, execution_backend_to_proto, feature_to_query_str, features_to_columnar, fetch_file, fetch_file_raw, floats_are_close, for_relationship, gather, generate_inference_resolver, generate_volume_name, geometry_as_geojson, geometry_from_geojson, geometry_nearest_points, get_features_feather_bytes, get_pydantic_output_structure, get_resolver, get_resolver_error_builder, get_server_context, get_trace_id_from_response, group_by_windowed, h3_cell_to_lat_lon, h3_lat_lon_to_cell, image_local_files, image_spec_bakes_handler_shim, inference, inject_trace_context, invalidate_web_identity_token, is_feature_set_class, is_feature_tag_override_active, is_in, is_model_handler, is_not_null, is_stale_route_error, json_format, json_parse
  - [Miscellaneous, part 2](https://docs.chalk.ai/api-docs/miscellaneous-part-2.md): json_stringify, json_value_strict, load_token, log10, log2, log_custom_metric, longest_common_subsequence, ltrim, make_model_resolver, map_from_arrays, map_keys, map_values, merge_model_spec, message, minijinja, model_artifact_volume_name, model_class_from_proto, model_deployment_from_proto, model_deployment_from_response, model_deployment_queue_name, model_deployment_revision_from_proto, model_deployments_from_response, model_encoding_from_proto, @model_handler, model_queue_policies, model_type_from_proto, model_version_from_metadata, normal_cdf, normalize_sort, ntile, onnx_run, openai_complete, openai_embed, ordinal_encode, over, override_feature_tags, parse_chalk_duration_s, percent_rank, pow, prompt_jev, proto_enum_value_to_name, proto_timestamp_to_datetime, proto_to_scaling_group, rank, read_secret, readiness_probe_to_proto, record_batch_to_arrow_ipc, recursive_encode_bulk_inputs, resolve_multi_query_query_name, @resolver, resources_to_proto, rich_to_pyarrow, row_number, rows_between, rtrim, safe_trace, scale_vector, scan_parquet, select, serialize_image_spec, set_agg, set_union, shift, sign, sort_order, st_area, st_astext, st_boundary, st_buffer, st_centroid, st_contains, st_convexhull, st_crosses, st_difference, st_dimension, st_disjoint, st_distance, st_endpoint, st_envelope, st_envelopeaspts, st_equals, st_exteriorring, st_geometries, st_geometryfromtext, st_geometryn, st_geometrytype, st_interiorringn, st_interiorrings, st_intersection, st_intersects, st_isclosed, st_isempty, st_isring, st_issimple, st_isvalid, st_length, st_linefromtext, st_linestring, st_multipoint, st_numgeometries, st_numinteriorring, st_numpoints, st_overlaps, st_point, st_pointn, st_points, st_polygon, st_relate, st_startpoint, st_symdifference, st_touches, st_union, st_within, st_x, st_xmax, st_xmin, st_y, st_ymax, st_ymin, stage_chalk_model_handler_image, startup_probe_to_proto, str_contains, str_slice, struct_col_to_table, tanh, task, to_snappy, trailing, upload_chalk_handler_artifacts, validated_metric, validated_metric_tags, value_to_proto, version, whole_partition, window, with_model_deployment_key, workflow, zip_with
