Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
ion-elgreco committed Dec 1, 2023
1 parent 18156fb commit ce84196
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
7 changes: 7 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ theme:
- navigation.tabs.sticky
- navigation.footer
- content.tabs.link
- content.code.annotation
- content.code.copy
nav:
- Home: index.md
- Usage:
Expand Down Expand Up @@ -80,6 +82,11 @@ plugins:
on_page_markdown: 'docs._build.hooks:on_page_markdown'

markdown_extensions:
- pymdownx.highlight:
anchor_linenums: true
line_spans: __span
pygments_lang_class: true
- pymdownx.inlinehilite
- admonition
- pymdownx.details
- attr_list
Expand Down
34 changes: 34 additions & 0 deletions python/deltalake/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,40 @@ def create(
configuration: Optional[Mapping[str, Optional[str]]] = None,
storage_options: Optional[Dict[str, str]] = None,
) -> "DeltaTable":
"""`CREATE` or `CREATE_OR_REPLACE` a delta table given a table_uri.
Args:
table_uri: URI of a table
schema: Table schema
mode: How to handle existing data. Default is to error if table already exists.
If 'append', returns not support error if table exists.
If 'overwrite', will `CREATE_OR_REPLACE` table.
If 'ignore', will not do anything if table already exists. Defaults to "error".
partition_by: List of columns to partition the table by.
name: User-provided identifier for this table.
description: User-provided description for this table.
configuration: A map containing configuration options for the metadata action.
storage_options: options passed to the object store crate.
Returns:
DeltaTable: created delta table
**Examples:**
``` .py
import pyarrow as pa
from deltalake import DeltaTable
dt = DeltaTable.create(
table_uri="my_local_table",
schema=pa.schema(
[pa.field("foo", pa.string()), pa.field("bar", pa.string())]
),
mode="error",
partition_by="bar",
)
```
"""
if isinstance(schema, DeltaSchema):
schema = schema.to_pyarrow()
if isinstance(partition_by, str):
Expand Down

0 comments on commit ce84196

Please sign in to comment.