Skip to main content
Version: 2.26.1

SQL Data Connector

Required package​

In order to use the SQL data connector you need to install the these packages:

$ edm install pandas sqlalchemy

SQLConnection Object​

class edge.api.SQLConnection(name, title, host, port, db_kind, db_name, username, password)

Represents a connection to a remote SQL data store.

You can access table contents via the .tables dictionary-like attribute.

Example​

# List table names
[1]: list(conn.tables)
['experiments', 'materials']

# Retrieve a table proxy object
[2]: mytable = conn.tables['experiments']

# Fetch the table contents as a Pandas dataframe
[3]: df = mytable.to_dataframe()

Properties​

Methods​

Reference​

kind​

Connection kind.

uid​

Unique ID of the connection.

name​

Connection name, for internal use

title​

Title for display

engine​

SQL Engine

tables​

View SQL tables

test()​

Test the connection to the external database

Parameters:

  • timeout (int, optional) — The time in seconds to wait before reporting a connection as failed. If not specified, it defaults to a short timeout.

Returns:

     ConnectionStatus

         One of VALID_CONNECTION, BAD_CREDENTIALS, or NO_CONNECTION.

to_dict()​

Translates the connection as a dictionary for serialization.

Returns:

     dict

     Connection contents as a dictionary.

SQLTable Object​

class edge.api.SQLTable(engine_proxy, name, *args, **kwargs)

Container for data from an external SQL Table.

Methods​

Reference​

to_dataframe()​

Retrieve a dataframe from the underlying tabular data.

Returns:

     pandas.DataFrame

         A dataframe containing the tabular data.