-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#8: moved example to examples/ directory
- Loading branch information
Showing
4 changed files
with
98 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import random | ||
|
||
import pandas | ||
|
||
import hyperleda | ||
|
||
client = hyperleda.HyperLedaClient() | ||
|
||
table_name = f"test_table_{random.randrange(0, 100000)}" | ||
|
||
table_id = client.create_table( | ||
hyperleda.CreateTableRequestSchema( | ||
table_name=table_name, | ||
columns=[ | ||
hyperleda.ColumnDescription( | ||
name="ra", | ||
data_type=hyperleda.DataType("double"), | ||
unit="deg", | ||
description="Right ascension", | ||
), | ||
hyperleda.ColumnDescription( | ||
name="dec", | ||
data_type=hyperleda.DataType("double"), | ||
unit="deg", | ||
description="Declination", | ||
), | ||
], | ||
bibcode="1992ApJ...400L...1W", | ||
) | ||
) | ||
|
||
print(f"Created table '{table_name}' with ID: {table_id}") | ||
|
||
data = pandas.DataFrame( | ||
[ | ||
{ | ||
"ra": 123.45, | ||
"dec": 25.56, | ||
}, | ||
{ | ||
"ra": 52.1, | ||
"dec": 65.58, | ||
}, | ||
] | ||
) | ||
|
||
client.add_data(table_id, data) | ||
print(f"Added data to the table '{table_name}':\n{data}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
from hyperleda import config, model | ||
from hyperleda.client import HyperLedaClient | ||
from hyperleda.config import * | ||
from hyperleda.error import APIError | ||
|
||
__all__ = ["HyperLedaClient", "model", "APIError", "config"] | ||
from hyperleda.model import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters