Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import mysql.connector as myc
- # conexão MySQL
- conMySQL = myc.connect (host = 'localhost',user = 'root',password = 'mysql',database = 'teste')
- cursorMySQL = conMySQL.cursor()
- sqlMySQL = """SELECT
- f.fid,
- f.uri,
- n.nid AS FK_REGISTRO_VIRTUAL
- FROM field_data_field_anexos a
- JOIN node n ON a.entity_id = n.nid
- JOIN file_managed f ON a.field_anexos_fid = f.fid
- WHERE n.`type` = 'registro_virtual' and f.fid = 76881;"""
- cursorMySQL.execute(sqlMySQL)
- result = cursorMySQL.fetchall()
- for fid, uri, nid in result:
- print(fid ,'-', uri.decode('utf8'), '-', nid)
- cursorMySQL.close()
- conMySQL.close()
Add Comment
Please, Sign In to add comment