I am setting up an environment in Jupyter that allows a user to query their Database Schema from AWS Glue. The Jupyter line magic accepts 2 arguments: the database name, and the table name.
These arguments are then parsed with split(), and separated into two arguments: database, and table.
What would be the best way to pass these to the glue.get_table call? Which accepts 2 argument which I was previously explicitly declaring in the code?
I'm fairly new to Python and may be missing an obvious answer here, but I'm currently passing them as string variables.
@line_magic('describe') def describe(self, line, local_ns = None):
database = line.split(" ")[0]
view = line.split(" ")[1]
glue = boto3.client('glue', region_name=ec2_metadata.region)
response = glue.get_table(DatabaseName='%s', Name='%s' % (database, view))
I am expecting to see these values passed into boto as if I were to write them in myself, but I am seeing
TypeError: not all arguments converted during string formatting
being thrown on the glue.get_table() function
尝试这个:
response = glue.get_table(DatabaseName=database, Name=view)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.